Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

blog headlines

edited April 2012 in Apps

I would like to use the blog app for news on my site. I have put the headlines dynamic object on the frontpage. This works fine but I would like to show the postingdate before or above the title. I have tried some things in the app scripts but withoud success.

Comments

  • That's a good suggestion! I added a "Show dates" option to the latest posts embed, which uses a new i18n-friendly date output coming in Elefant 2. This is now on Github in the master branch.

    To achieve similar results in Elefant 1.2, here's an example that should work:

    https://gist.github.com/2339929

    If you save these to apps/myapp/conf/embed.php, apps/myapp/handlers/headlines.php and apps/myapp/views/headlines.html this should appear as a new option in the Dynamic Objects embed named "My App: Latest Posts" and the output should look like this:

    Let me know if you run into any issues.

  • If I update the scripts like you said and indeed a date is showing before every headline, but it is always "Jan 1". I tried to change the gmdate in headlines.html in several ways but without succes. When I remove the gmdate function completely the right date/time from the database shows up in the headlines. So it seems the gmdate function should be changed in one way or the other. How I did not find out. Changing only the dateformat gives the corresponding format in the headlines but still with "Jan 1". Maybe there is something wrong with the "%S"?

  • Ah yes, the date line should have been {{ loop_value->ts|date ('M j', strtotime (%s)) }} since the timestamp is a string and needs to be converted with strtotime(). I updated the gist as well.

  • Great! Thanks, Now it works fine.

Sign In or Register to comment.