Hi there,
I've got this thing set up but i'm not getting the response I would like to have. Can someone please tell me what I'm doing wrong?
[[+tv.referenceLogo:empty:then=`
[[!firstLetter? &input=`[[+tv.referenceName]]`]]
`:else=`
<img class="ref-img" src="[[+tv.referenceLogo]]" width="224" height="126" alt="[[+pagetitle]] - [[pdoField? &id=`[[UltimateParent? &id=`[[*id]]`]]` &field=`pagetitle`]] - [[++site_name]]"/>
`]]
Needed outcome; if the TV "referenceLogo" is empty, output the first letters of each word in the "referenceName" TV.
firstLetter snippet:
<?php
$string = "$input";
$expr = '/(?<=\s|^)[a-z]/i';
preg_match_all($expr, $string, $matches);
$result = implode('', $matches[0]);
$result = strtoupper($result);
echo $result;
The snippet works if I take it out of the 'then' statement. So that shouldn't be the problem?
What i'm getting out of the code right now is the else statement. So it appears that the empty/then statement/combination doesn't work?
If someone could advice that would be great. Thanks in advance.
Coen