Fork me on GitHub

(solved) AmazingGrace - does the News Template only knows April ?  Bottom

  • On www.rhein-sieg-freizeit.de I use a modified AmazingGrace Template. I changed the news template code so that it displays the actual "published on" date of an article not the date it was submitted into zikula.

    But now I have the problem that all Articles have the correct date but the month stays "April". As I only changed "briefdate", what else is going wrong here? What to do that the month also is displayed correct?

    Quote

    < div class= "entrydate" >< !--[ $info.time|date_format:"%b "]-- >
    < !--[$info.briefdate|date_format:"%d "]- - >




    edited by: Technobilder, May 03, 2009 - 08:55 AM
  • info.time must be changed to info.briefdate too then it's working as expected icon_smile
  • Hi,
    I use the following in a special display format:

    Code

    <div class="news_index_date"><!--[$info.from|pndate_format:"%b"|pnvarprephtmldisplay]--><br /><b><!--[$info.from|pndate_format:"%d"|pnvarprephtmldisplay]--></b></div>

    (Online example in my upgrade in progress here)
    sice briefdate is already a converted date, you should not use the date_format on that one again.
    In the code briefdate is formed by:

    Code

    $info['briefdate']     = DateUtil::getDatetime($info['unixtime'], _DATEBRIEF);

    Also check out the date format info for Smarty here. A date conversion on something that is already a converted date could go wrong. You should use the unix timestamp in that case, which can be done by using $info.unixtime.

    But it might be best to use the pndate_format modifier (which uses DateUtil internally) with the $info.from as above, since that is the correct time field to use from News 2.4 onwards. It represents the published date of the article.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • You got it working already icon_biggrin

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • My solution isn't working - if you use briefdate the template now displays the actual days date every day - yesterday my articles were May 3rd, today the're all may 4th.

    So I'll see if espaan's solution will work.
  • Ok, it works correct (as far as I can see) with
    < !--[$info.from|pndate_format:"%d"|pnvarprephtmldisplay]- ->
  • Ok, next problem is in news_user_articlecontent.html

    It's date=$info.briefdatetime] there too, but if I change that to date=$info.from|pndate_format] nothing happens, the date stays like briefdateformat.
  • Sorry, lAst posting was my fault - the correct template is in AmazingGrace itself and the modification works too for this.
  • Ok great.
    We should make a Wiki section in cozi/news or here on changing the templates, what is available in the various templates, how to add certain constructions, in short how to create a different layout of the News functions.
    I had already written down in the roadmap for 2.5 to make some more documentation avaiable icon_wink

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • 0 users

This list is based on users active over the last 60 minutes.