Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hello,

I am following the tutorial http://docs.couchcms.com/tutorials/portfolio-site/blog.html, Diving Deep Blog Part 1. I want to output the post date as suggested by the tutorial, i.e. format="jS M, y". However, the front page does not change. The date still persist to something like this: 2016-11-05 09:23:55. How to troubleshoot this? Thanks!
Hi,

Could you please post the exact code you have placed in your template?
Here,
Code: Select all
<cms:show k_page_date format="jS M, y"/>
atorui wrote: Here,
Code: Select all
<cms:show k_page_date format="jS M, y"/>

Please, change it to this corrected tag:
Code: Select all
<cms:date k_page_date format="jS M, y"/>
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Works!
I have a small hitch.

I am using the <cms:date> for birthday display.

What happens is that, even if the birthday field is blank (<editable region is datetime), on the front end (and JSON) the current date is displayed.

What I want is that if field is blank nothing should be displayed, especially the current date of the day!

Please advise.
Image
where innovation meets technology
You should use <cms:if> to check if the date field has any value before handing it over to <cms:date> for display.
So, for example, if your date field is named 'my_date', instead of directly doing this -
Code: Select all
<cms:date my_date format="jS M, y"/>

- you should be doing this -
Code: Select all
<cms:if my_date>
    <cms:date my_date format="jS M, y"/>
</cms:if>

Hope it helps.
Right Away... Problem SOLVED!!!

Thanks a ton KK Sir!!!
Image
where innovation meets technology
8 posts Page 1 of 1
cron