Is it possible to format the way the date is displayed in content?
eg. I have {$date}, the field is a datepicker, I just want the month and year displaying.....
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Kevin Jardine@kevin
Kevin Jardine - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- mick bullock@mbull22
mick bullock - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- mick bullock@mbull22
mick bullock - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- mick bullock@mbull22
mick bullock - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
You must log in to post replies.Changing the datepicker format is possible so long as it does not confuse the PHP strtotime function.
But it would require some custom coding as there is no option for that through the web.
Kevin
@Mick - welcome backk from your craziest UK winter in 30 years' hibernation ;-) Throw me a screen shot of *your date field - display of only MMM YY -> can be patch fixed with JS.. a few lines of code, easy stuff [ call it lateral out of the box thinking or more properly - the DDS taxonomy for efficient code patches ;-P ]
Hello again Mr. DeScoop (been away from elgg for a while) - Yeah, I suppose winter has been a bot harsh, but to be honest, last year was much worse.
My customer has settled on a simpler solution (which actually helps me out because the date picker was taking ages to display).
Using Kevins forms plugin, I'd created a simple content form which included a 'date' field. My customer wanted only the Month and Year displaying in the content view. I'm not sure if you're familiar with Kevin's Forms plugin, but the 'Template' function allows you to add your own layout - see example below:
I wondered if it was possible to add something simple to '{$date}' field as with the '{$image}' field?
Good to hear from you again and I hope to be back for a while : )
you mean ?
<p>{$date}</p>
need to show me a screenshot of that code actually displaying something - then can work out some JS or PHP for diff date display formatting.
Don't worry too much buddy. I have persuaded my customer to have 2 drop-down fields instead; one for Month and one for Year.
This is how the form is displayed:
March 12, 2011
If the 'template' is php code ;-)
$pos1=strpos($date,",");
$MyDate=substr($date,0,$pos1-1)
before the template html
or using <?php and ?>
gives you the first part - Mmmmm DD and you can still use the DatePicker's popup.
Cool! Thanks again : )
lolz ;-) you gotta say that it works ! ;-X