I’m seeking some hints on how to output a particular TV when there is a presence of a value in another. Basically,
if [*tv1*] has a value, output [*tv2*]
else output [*tv3]
and in another case,
if [*tv4*] has a value, output "some text" + [*tv4*]
else output nothing
I’m fairly new to modx and php, so I’m in learning curve mode — trying to pick things up as quickly as I can, but am finding I need to lean on the experience of others in the meantime! Thanks so much for any input y’all have.
Cheers,
Jim
------
Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
Thanks guys for the leads.
@ganeshXL: I’m building an article collection where separate TVs are used to input these data: date, publisher’s name, publisher’s URL (optional), title, subtitle, lead author last name, lead author first name, and co-authors (optional). Because there are a couple optional values, I need them to be output only when present. So the two behaviors I’m going for are:
- The publisher’s URL TV uses the URL input type with the hyperlink widget. In the widget’s Display Text field, I have entered the publisher’s name TV — which generates the publisher’s name wrapped in its associated link. If no URL has been supplied, I’d like the TV that holds the publisher’s name to be output, instead of the publisher’s URL.
- Next, there are instances where there are no co-authors, so I need a way to add them to the output when a value is present.
Note, the motivation for separating all this data is to allow flexibility in sorting and manipulating the data in different output contexts (
e.g., abbreviated homepage listings via ditto).
------
Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
PHx rocks, thanks for the pointer in the right direction!
------
Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.