Hi,
I’m just about done building my first MODx site and am massively impressed - compares much better to Expression Engine than I thought it would...
I have come across something I haven’t been able to solve though and would appreciate some help on a couple of issues...
I have 5 template variables for images that may or may not be set for each page and I’m not sure how to check whether or not the TV is set before it is output. The code in my template to pull these out is like this::
<li> <img src="[*image1*]" alt="" /></li>
<li> <img src="[*image2*]" alt="" /></li>
<li> <img src="[*image3*]" alt="" /></li>
<li> <img src="[*image4*]" alt="" /></li>
<li> <img src="[*image5*]" alt="" /></li>
I want my templates to validate, so don’t want to output the list item if there is no image set. Could someone tell me how to check whether the TV is set?
In Expression Engine I could do this:
{if image}
then output stuff here...
{/if}
Would massively appreciate some help on that - I can’t find any documentation on TV conditionals....
One other thing that I could do with some help on is that on the index page of my site I have the latest news item called using the following code:
[!Ditto?startID=`15` &queryLimit=`1` &dateFormat=`%d/%m/%Y` &tpl=`frontpagenews`!]
This displays the news item correctly but puts Resource Array Error underneath. If I remove &queryLimit=`1, then the error does not display...
Thanks in advance to anyone that can shed some light on these things - If I can get my head round these things I’ll be using MODx for many more projects ;-)
Cheers,
Alex.
or you can write a little snippet
I think it’s better to write 5 lines of php instead of use phx...
Hi,
That worked brilliantly - thankyou!
Now, would be amazing if anyone can tell me what’s wrong with this Ditto call;
[!Ditto?startID=`15` &queryLimit=`1` &dateFormat=`%d/%m/%Y` &tpl=`frontpagenews`!]
which puts ’Resource Array Error’ underneath the output - seems to be caused by &queryLimit=`1` as the error doesn’t occur if this is removed - but I only want the first news item to appear on the front page.
Thanks again!
Alex.
Try:
[!Ditto? startID=`15` &queryLimit=`1` &dateFormat=`%d/%m/%Y` &tpl=`frontpagenews`!]
U were missing a space after the ?
Space isn’t needed if it’s the first parameter. With space an ampersand is missing.
Tried display=`1` instead of queryLimit?