Page 1 of 1
Programming Tag or Category Textbox
Posted: Thu Dec 10, 2009 5:36 pm
by Ansgar
Hiho!
I want to program a simple sidebar-plugin, that displays some content depending on a tag or category.
For example:
- if tag="tomato" I want to display text-a
- if category="recipe" I want to display text-b
But how do I get an array of the article tag (set by freetag plugin) and the name of the category?
Is there anywhere a list of s9y-variables?
Any idea appreciated.
regards
Ansgar
Re: Programming Tag or Category Textbox
Posted: Thu Dec 10, 2009 5:47 pm
by garvinhicking
Hi!
I don't know the exact key, but check a print_r($serendipity) and search for your variable string, it should be contained there, that's the easiest way to look up things.
There is a list of Smarty variables on the s9y.org technical documentation, but if you use PHP code then those are different.
Regards,
Garvin
Re: Programming Tag or Category Textbox
Posted: Thu Dec 10, 2009 9:19 pm
by Ansgar
Hiho!
Thanks for your hint!
The variable string ist 'freetag_tags'.
Neverless I'm not that good at php and though I tried a lot - I didn't get the tags:
print_r($serendipty['freetag_tags']); does not work
$tags = $serendipty['freetag_tags']
var_dump($tags)
prints out: NULL
I've also tried various things like $serendipity['GET']['properties']['freetag_tags']
Where is my fault?
regards
Ansgar
Re: Programming Tag or Category Textbox
Posted: Thu Dec 10, 2009 11:37 pm
by onli
Hi
Use print_r to display full $serendipity (don't forget to call 'global $serendipty' before) and have a look. The plugin itself uses $serendipity['POST']['properties']['freetag_tagList'] when getting the tags for preview, I don't know if that is also set when the sidebar in normal view is displayed.
sincerely
Re: Programming Tag or Category Textbox
Posted: Fri Dec 11, 2009 9:21 am
by garvinhicking
Hi!
freetag_tags is the Smarty variable string. You might be able to get it through $serendipity['smarty']->get('freetag_tags')?
Regards,
Garvin
Re: Programming Tag or Category Textbox
Posted: Fri Dec 11, 2009 10:37 am
by Ansgar
Hiho!
I've tried all of your hints, but nothing works...
But I've startet to change the code of the function displayTags. By this I can work with the tags and I've managed to implement my functionality basically.
And: I've ordered the Serendipty Handbuch yesterday. Kind of christmas present.
I hope that the description of smarty und plugin-programming are good enough that even I can understand them...
Thanks a lot for your help!
... hopefully someday I can present you my finished Plugin
regards
Ansgar
Re: Programming Tag or Category Textbox
Posted: Fri Dec 11, 2009 2:42 pm
by garvinhicking
Hi!
Hey, that's good. I know for a fact the book has a list of the variable at some place...

[but I don't have it here right now *g*]
Best regards,
Garvin