Choosing a form dynamically
Here is a very short tip which may seem obvious, but had me stumped for a while today, so thought I would share. You may judge me accordingly ;-)
Here is what I wanted to do: Display a portfolio cycle based on the category fed to the
<txp:output_form form="something" /> tag. I have three categories setup:
Using the txp:category tag I wanted to do something like this:
<txp:output_form form="<txp:category />_cycle" />
So the idea is for Textpattern to fill in my category name with something like this dynamically:
<txp:output_form form="design_cycle" />
And then I have a corresponding form conveniently named
design_cycle ready for display.
It does not work!
Here is why – the new tag parser introduced in 4.07 changed the way tags are parsed. We don’t need to know the ins and outs – we just want it to work!
The correct usage
Here is the correct usage for my example above:
<txp:output_form form='<txp:category />_cycle' />