Combining Tag Attributes, AND, OR and Variables in Movable Type

| No Comments | No TrackBacks |
This forum posting asks the question if it is possible to do something like 
<mt:entries tag="@sometag AND $somethingelse">...<mt:entries>
to get all entries tagged with "@sometag" and some other tag (which is stored in the $somethingelse variable).
As it is written, the code will not work.  Variable substitution in a tag argument will only work if the variable is the only thing in the argument.

However, there is a workaround:

<mt:setvarblock name="myarg">@sometag AND <mt:var name="somethingelse"></mt:setvarblock>
<mt:entries tag="$myarg>
...
</mt:entries>​

Simply use the 'setvarblock' tag to create a new variable ($myarg) that will hold the entire argument, tags, boolean operators, variables and all. Then use that new variable as the argument and presto...  This should also work for other types of tags (categories, pages, authors...) and arguments (tags, categories, roles...).

No TrackBacks

TrackBack URL: https://www.movabletips.com/cgi-bin/mt/mt-tb.cgi/72

Leave a comment