Page 1 of 1
I need to access the entry tags in template
Posted: Fri Sep 08, 2006 10:26 am
by Fencer
Hello,
is there a way to get a list of tags defined for the particular entry, preferrably as a variable at the template?
Thank you.
Filip
Re: I need to access the entry tags in template
Posted: Fri Sep 08, 2006 10:35 am
by garvinhicking
Hi!
You mean you want to see all available variables for {$entry}? Like $entry.title, $entry.body etc.?
http://www.s9y.org/102.html should be what you need.
Else you could set $serendipity['security'] = false in your templates config.inc.php and use <pre>{$entry|@print_r}</pre>.
HTH,
Garvin
Re: I need to access the entry tags in template
Posted: Fri Sep 08, 2006 2:49 pm
by Fencer
Thank you Garvin but I am afraid it is not there (or I am blind). What I need is a variable/property containing all tags for the selected entry, defined through the "Tagging of entries" plugin. Is it possible to get this information at the entries.tpl?
Filip
garvinhicking wrote:Hi!
You mean you want to see all available variables for {$entry}? Like $entry.title, $entry.body etc.?
http://www.s9y.org/102.html should be what you need.
Else you could set $serendipity['security'] = false in your templates config.inc.php and use <pre>{$entry|@print_r}</pre>.
HTH,
Garvin
Re: I need to access the entry tags in template
Posted: Fri Sep 08, 2006 2:52 pm
by garvinhicking
Hi!
Ah. This one should be inside the $entry.properties array somewhere. Make that print_r trick, and you should spot it instantly.
HTH,
Garvin
Re: I need to access the entry tags in template
Posted: Fri Sep 08, 2006 3:24 pm
by Fencer
I've created a config.inc.php file in the /templates/contest directory (the template which I use) and put the $serendipity['security'] = false line to it. However, when I try to add <pre>{$entry|@print_r}</pre> at the end of the entries.tpl and reload the entry page, I receive this error message:
Fatal error: Smarty error: [in file:/var/www/brainking.info/web/templates/contest/entries.tpl line 250]: [plugin] (secure mode) modifier 'print_r' is not allowed (Smarty_Compiler.class.php, line 1908) in /data/www/brainking.info/web/bundled-libs/Smarty/libs/Smarty.class.php on line 1088
Is there anything else I have to do?
Filip
garvinhicking wrote:Hi!
Ah. This one should be inside the $entry.properties array somewhere. Make that print_r trick, and you should spot it instantly.
HTH,
Garvin
Re: I need to access the entry tags in template
Posted: Fri Sep 08, 2006 5:01 pm
by garvinhicking
Hi!
Sorry, wrong variable. Needs to read
$serendipity['smarty']->security = false;
Regards,
Garvin
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 12:22 pm
by Fencer
garvinhicking wrote:Hi!
Sorry, wrong variable. Needs to read
$serendipity['smarty']->security = false;
Regards,
Garvin
I've tried this and it works. Thank you.
However, the entry tags have appeared only as a part of the $entry.body property (because that's where I set them to show up) but not at a standalone property. So unless there is another way, I would have to parse the body property and get the entry tags out of it.
Filip
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 1:23 pm
by garvinhicking
Hi!
That shouldn't be - which version of the freetag plugin are you using?
Regards,
Garvin
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 1:33 pm
by Fencer
garvinhicking wrote:Hi!
That shouldn't be - which version of the freetag plugin are you using?
Regards,
Garvin
Tagging of entries
Allows freestyle tagging of entries
version: 2.63
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 6:46 pm
by garvinhicking
Hi!
Du you have the plugin "Extended properties for entries" installed? Which serendipity version do you use?
Regards,
Garvin
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 6:57 pm
by Fencer
garvinhicking wrote:Hi!
Du you have the plugin "Extended properties for entries" installed? Which serendipity version do you use?
Regards,
Garvin
Extended properties for entries
(cache, non-public articles, sticky posts)
version: 1.8
I guess my Serendipity version is 1.0 because I've found this line at the serendipity_config.inc.php:
// The version string
$serendipity['version'] = '1.0';
By the way, is there a way how to find the Serendipity version on the Admin page?
Filip
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 7:30 pm
by garvinhicking
Hi!
Okay, if you have that plugin installed and are using s9y 1.0, then all should be well.
What is the output of {$entry.properties|@print:r} if you put that in the foreach loop of your entries.tpl file?
The s9y version should be printed in the footer of the admin section!
HTH,
Garvin
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 7:43 pm
by Fencer
garvinhicking wrote:Hi!
Okay, if you have that plugin installed and are using s9y 1.0, then all should be well.
What is the output of {$entry.properties|@print:r} if you put that in the foreach loop of your entries.tpl file?
The s9y version should be printed in the footer of the admin section!
HTH,
Garvin
I use your "contest" style which contains a custom admin interface, could it be the reason why I don't see the s9y version at the footer of the admin section?
Before I put the {$entry.properties|@print:r} in the foreach loop, is there a way how to show this debug info only for the admin? I don't want to display my experiments to everyone who observes the blog.
Filip
Re: I need to access the entry tags in template
Posted: Sat Sep 09, 2006 9:34 pm
by garvinhicking
Hi!
Hm, I currently don't have a testblog to check that, but I am quite sure that my contest theme does show the version info...
About only showing for admin: Yes, you can use a check to see if a user is logged in. Check
www.s9y.org, technical documentation for a list of all variables that you can use, I don't know it by heart.
HTH,
Garvin
Posted: Tue Sep 12, 2006 10:46 am
by Fencer
All right, I've finally got something. This is an excerpt of the print_r output:
Code: Select all
[properties] => Array
(
[freetag_tags] => Array
(
[0] => javascript
[1] => messages
[2] => settings
)
[freetag_tagList] => javascript,messages,settings
)
However, the problem is that it is shown only when the main blog page (containing more entries at once) is displayed. When I go to the single entry page (which is exactly where I need to use the entry tags property), the [properties] array is empty.
Is there a solution of this issue?
Filip