Hi there,
I'm trying to output a list of pages using wayfinder. Each page has a template variable that is a link. If this is set I want to output the name of the page as a link to the url specified in the tv. If the tv is not set, I just want to output the name of the page.
What I want to know is how do I use snippets to output the relevant html?
So far I have it working so far that it displays the following row template:
<li>
<a href="[[processTV? &myId=`[[+id]]` &myTV=`assemblyInstructions` ]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>
Using this snippet:
<?php
$doc = $modx->getObject('modResource', $myId);
return $doc->getTVValue($myTV);
Obviously this makes everything a link, but some of the hrefs are blank.
I want to change it so that if the tv is not set it just outputs the linktitle with no anchor.
Please help! I've been trying all morning with no success!