Hello
Im a Modx newbie and wondered if the following is possible and if it is how is it done.
I have a simple Start date TV that sets thw start date of an event. Im also using the ListIndexer snippet to list my events on an events page.
What i want to know is can I call my StartDate TV from inside the ListIndexer snippet so it can display start date of the event too?
The line i’d be updating n the snippet is this one:
$output .= ’<a href="[~’.$recentRecord[’id’].’~]" title="’.strip_tags($recentRecord[’pagetitle’]).’">’.$recentRecord[’pagetitle’].’</a> ’;
Thanks, I hope some can help, I’m not sure if and how it can be done
bS
Thanks for the reply...
This is where I get lost! I’ve had look at this function but am not quite sure how/where to implement it?
I have a simple text TV that takes date as a string called StartDate.
What do I need to do with the function bit?
Excuse my ignorance...
bS
You’ll want to first get the TV output using something like this:
$tvStartDate=$modx->getTemplateVarOutput(’StartDate’,$recentRecord[’id’]);
The getTemplateVarOutput function returns an array, so you should then use $tvStartDate[’StartDate’] wherever you want to place that output (and depending upon how you’ve stored your date info, you may also need to use strtotime() or otherwise format it for your purposes).
It works a treat!
Thankyou for allowing me to extract valuable information from your brain!
bS
BTW: Can’t believe I never stumbled across ModX before now, I have been using Etomite for a good while now but the flexibility of ModX is astounding in comparison and with the confidence of knowing that the forum is there for help and support, I’m now fully converted!
Cheers