The values containing spaces must be escaped, otherwise the parsing will not
work. Please do now forget to use the issue/article preview function: this
will display syntax errors so you *will know* why it doesn't work.
E.g.: constraints="topic is Global\ Warming:en"
In this case "Global Warming" is the topic name.
Mugur
On Fri, Apr 24, 2009 at 7:29 PM, wrote:
> Author: Lee
> Link: http://code.campware.org/phorum/read.php?8,7050,7050#msg-7050
>
> --------------------------------------------------------------------------------
>
> Have I mentioned that I LOVE campsite??
>
> I am try to list articles on a section page which match a certain topic.
> Here is what I am doing:
>
> {{ assign var=cat value=`$smarty.get.category` }}
> {{ if $cat }}
> {{ assign var=cat_topic value="topic is $cat:en" }}
>
> {{ $cat }}
> {{ else }}
> {{ assign var=cat_topic value="" }}
> {{ /if }}
>
> {{ list_articles length="20" constraints="OnSection is On $cat_topic"
> order="byPublishDate desc" }}
>
> ...
>
> {{ /list_articles }}
>
> I'm sure the above is the "hard way" but regardless, I cannot get only the
> requested topic to show. It shows everything under that section.
>
> I tried simply including {{ set_topic name=$cat_topic }} but that did not
> work either. My guess is part of the problem resides in that many of my
> topic names have spaces in them, eg. "Beverly Shores".
>
> Can anyone point me in the right direction or provide me any guidance?
>
> --
> Sent from Campware Forums
> http://code.campware.org/phorum
>
I understand the escaping of spaces, but if I send a topic as a parameter, and create a variabe {{ $var }}, how can I test to see if $var contains a space and automatically espace the spaces?
When I display an article, I provide a link which says "More in My Topic". Click the link and it sends a parameter ...?My+Topic. Since the link is computer generated, I do not know in advance whether it contains a space.
Alright, I know when I'm defeated. I could use a little help with syntax. Again, the scenario is:
1) I pass a parameter which contains the topic I wish to be displayed.
2) I grab the parameter and escape any spaces if there are any.
3) Insert that parameter within list_articles.
Here is what my thinking is, but I know the syntax is wrong: