Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2007-06-28 11:45:53

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: if_article_keyword

I need some practical examples :-)

if keywords: weather, hamburg
output_form form=“weather_hamburg”
else

if keywords: books
output_form form=“amazon_context_ad”
else

if keywords: map, hamburg
output_form form=“google_map_HH”
else

if keywords: StreetName
output_form form=“link_list_StreetName”
else

ras_if_article_keywords sounds very promising.

What I am missing is a possibility to not only return true/false but also to return the parameters as output i.e. to use it to automatically build a search link like in the following example

if keywords: hamburg
href=google.com/?q=hamburg
else


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#14 2007-06-28 18:06:41

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: if_article_keyword

Hmm mm?
Good question. txp:keywords will work for all of them, but won’t segregate by attribute.

Offline

#15 2007-06-28 18:54:54

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: if_article_keyword

txp:keywords: “Textpattern will replace this tag with the keywords associated with the article being displayed.” This looks like an output option only and not like an if/else statement as I have mentioned in my examples.

ras_if_article_keywords has four ‘true’ scenarios which is already very good and promising for an if/else statement depending on the existence of single or a pattern of keywords. I still have to think about concepts how to implement it in an article form (with some useful automagical output) and not only inside a single article.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#16 2007-06-28 18:59:35

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: if_article_keyword

PS / FYI: The plugin info for the ras_if_article_keywords plugin says that this thread is the official thread to discuss that plugin. That’s the reason why I landed here. The thread looks a little wider though :-)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#17 2007-06-28 19:10:21

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: if_article_keyword

The thread started as a feature request. After submitting a patch I made the plugin available for the present.

Offline

#18 2007-06-29 04:12:44

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: if_article_keyword

<txp:ras_if_article_keywords keyword_list=“hamburg” mode=4>
href=google.com/?q=hamburg (or whatever you like for the true option)
<txp:else />
whatever you want for the not true option
</txp:if_article_keywords>

would return true for any article that includes hamburg as a keyword.

Offline

#19 2007-07-03 14:20:00

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: if_article_keyword

‘Hamburg’ was meant as a variable!
Maybe an OR variable (read: handle an array)

(Referring to this comment)

ras_if_article_keywords keyword_list=“hamburg, london, paris, new york, bombay” could possibly return more then one (!) output containing the single list variables from that array.

<txp:ras_if_article_keywords keyword_list="hamburg, london, paris, new york, bombay" mode=4>
href=google.com/?q='variable-1' <!-- hamburg if keyword exists -->
href=google.com/?q='variable-2' <!-- london if keyword exists -->
href=google.com/?q='variable-3' <!-- paris if keyword exists -->

<!-- ... I hope you get the picture. -->

<txp:else />
<!-- whatever you want for the not true option -->
</txp:if_article_keywords>

This way it would be much easier to use that keyword dependant array in an article form. This would also fit very fine into the if_section or if_category logic.

Keyword dependant content is a great step forward inside the TXP if/else tag logic. ras_if_article_keywords is on the right way :-)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#20 2007-07-03 16:34:05

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: if_article_keyword

mode = 4 truncates the variable list to its first member, the intention is to look for a single word. The use of variables is what I understood you to suggest, the problem is that there is no need for a variable and an attribute if the tag selects only when the keyword searched for is present?
Something like <txp:php> $myarray = do_list($thisarticle[‘keywords’]); </txp:php> would make the keywords available as an array; this, I think, would be a different plugin though.

Last edited by rsilletti (2007-07-03 18:24:12)

Offline

#21 2007-07-04 11:13:15

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: if_article_keyword

Sorry for using mode=4 in my theoretical example. I have not used ras_if_article_keywords yet. I was just thinking about extending the plugin possibilities for a wider field of usage i.e. in an article form.

For using all (!) the existing keywords from an article there already exists the possibility to use the plugin tru_tags to create individual links (only). I am using it with single articles to create search arrays, linking to Google, Technorati and Amazon, from the article keywords. Maybe you can look at the tru_tags source or usage instructions?

With your plugin ras_if_article_keywords the interesting possibility exists to create if/else situations based on the existence of keywords (or non-existence). Additionally my draft asks for a possibility to use an array to have an easier base for multiple if/else decisions inside of one (!) plugin ras_if_article_keywords tag. Second my draft asks for a possibility get back the found keyword(s) as an output – triggered by a nested tag inside the plugin ras_if_article_keywords if/else condition.

My concept is not urgent. I can realize that array concept already today by using multiple ras_if_article_keywords tags in a list. Database performance also will be better when using the array instead of batch processing a list of multiple ras_if_article_keywords tags.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB