Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#865 2011-06-15 01:17:28
- frickinmuck
- Member
- Registered: 2008-05-01
- Posts: 118
Re: glz_custom_fields
Thanks, uli! My hero! :^)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#866 2011-06-16 23:09:12
- frickinmuck
- Member
- Registered: 2008-05-01
- Posts: 118
Re: glz_custom_fields
Ok, I’m realizing that what I want to do is a bit more complex than what’s being done here, or else I don’t have the sophistication to take this where I need to, or maybe that tutorial is a bit too incomplete for someone who needs a bit more hand-holding like me.
I like the way this essentially enables one to display articles according to a custom field, and I need that functionality, but I need to take it farther. Here’s what I’m hoping to be able to do with this:
1] Output the custom field values (otherwise known as the custom field options, otherwise known as the categories I’ve added in the category tab) as a menu (either as an “option/select” menu or just as a ul) in the sidebar that the visitor can use to sort articles, and have that list of available options appear based on what is essentially the parent category (which is also the custom field name). For example, if the parent/custom field was “Animals” the menu would have:
Cats
Dogs
Horses
Pigs
Cheetahs
Porcupines
2] A list of all articles that are using the selected custom field option will then display in the main area of the page when the visitor selects that option from the menu on the sidebar of the site. For example, if they clicked on “Dogs”
How to train a dog to “sit” November 12, 2011
Why I’ve never liked Rottweilers Dec 23, 2011
Canine psychology tricks Jan 4, 2012
The 5 Best Hounds for Life on a Farm Jan 23, 2011
Could anyone point me in the right direction? Since these aren’t assigned as category1/category2, they don’t work as a category list (or is it not working for some other reason?). Maybe I’m beginning to confuse myself, but I’m having a hard time getting started in the right direction.
EDIT: Perhaps a simpler way of explaining my purpose is to say, I’m hoping to use this a sort of a tagging system, and would have several such “menus” based on different parameters I want the articles to have. For example, one menu might be “Animals”, as discussed earlier, and another menu might be “Article Type” and have the following options:
Opinion
Instructional
Lists
In other words, any one article could appear in the resulting article list depending on the menu and item selected. The first article listed above,
How to train a dog to “sit” November 12, 2011
Would appear if you selected “Dog” from the “Animals” menu, and it would also appear if you selected “Instructional” from the “Article Type” list.
I moved this to its own How Do I post and added more detail on what I need.
Last edited by frickinmuck (2011-06-17 15:14:39)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#867 2011-06-20 21:20:37
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: glz_custom_fields
Hi,
Using 1.2.4
Txp 4.4.1
Installed it, got an error
Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘TYPE=MyISAM’ at line 7 CREATE TABLE `custom_fields` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL default ‘’, `value` varchar(255) NOT NULL default ‘’, PRIMARY KEY (id), INDEX (`name`) ) TYPE=MyISAM in /Users/Name/Sites/site.dev/textpattern/lib/txplib_db.php on line 89
<txp:way_too_cool />
Offline
#868 2011-06-26 08:03:09
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: glz_custom_fields
I install the plugin on a site I just upgrade to 4.4.1
The “Options” link is missing : impossible to setup the install …
(And many mySQL errors on the article edit page …)
Last edited by jpdupont (2011-06-26 08:07:09)
Offline
#869 2011-06-27 13:20:03
Offline
#870 2011-07-03 15:25:51
- worths1
- Member
- Registered: 2005-03-08
- Posts: 18
Re: glz_custom_fields
King Hack here! I cobbled together a short custom script for retrieving a list of Flickr photosets into a custom field. It works, but I want to make sure I haven’t opened some gaping security hole or otherwise done something dumb or inefficient. If someone knowledgeable gets a chance to scan this, let me know if you see something bad. Thanks!
Here ‘tis.
<?php
function list_Flickr_sets($custom_field, $custom_id, $custom_value) {
$sets = array();
$url = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key={your_key}&user_id={your_id}';
$contents=file_get_contents($url);
$xml = new SimpleXMLElement($contents);
$limit = count($xml->photosets->photoset)-1;
$xml_array = json_decode(json_encode($xml->photosets), true);
for($i=0;$i<=$limit;$i++) {
$sets[$xml_array['photoset'][$i]['@attributes']['id']] = $xml_array['photoset'][$i]['title'];
}
return glz_selectInput($custom_field, $custom_id, $sets, $custom_value, "0");
}
EDIT: Okay, so this is not working as I intended. While the custom field “gallery” shows Flickr sets by title, <txp:custom_field name=“gallery” /> outputs the id (I think). I’ll edit this post again if I’m able to resolve this on my own and use it in a Flickr badge.
EDIT 2: Holy #%@ crap! You guys that do this for a living, my hats off. I spent all day to get the above. If you see something more efficient, I’d appreciate the advice.
Last edited by worths1 (2011-07-04 18:44:26)
Offline
#871 2011-07-04 22:39:44
Re: glz_custom_fields
Weird. in 4.4.1 I’m no longer able to edit the custom script path.
Offline
#872 2011-07-17 10:37:42
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: glz_custom_fields
Hi Gerhard
Could you give us an estimate when you going to release the new plugin version for 4.4.1
At the mo I am building an real estate site with that plugin in 4.4.0
<txp:way_too_cool />
Offline
#873 2011-07-17 11:47:55
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Offline
#874 2011-07-20 11:14:23
Re: glz_custom_fields
ola
my problem now is, that i can create and edit custom_fields, but when i change it to “textarea” it simply doesnt appear on the write tab, when i change it back to textfield it appears.
using txp 4.4.1
found the issue: i disabled the excerpt field. when i renabled it, the custom_field appeard again..???
guess its been placed behind the excerpt, causing it to not appear, if excerpt is off..
Offline
#875 2011-07-22 09:12:13
Re: glz_custom_fields
I am slightly behind on this chaps, I started with a few fixes and then got carried away. I will have to curb my enthusiasm because otherwise it will be a few more weeks before I’ll wrap up the refactoring. So, plan is to have the new PATCH version out this weekend.
Offline
#876 2011-07-22 09:13:49
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: glz_custom_fields
Great thanx, I dont have a problem anymore, it just failing to write to the mysql when installing. Good luck finding motivation :P
<txp:way_too_cool />
Offline