+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Display age of listing

Hybrid View

  1. #1

    Display age of listing

    Is there a smarty short code for displaying age of listing.

    eg: if the listing was listed an hour ago it will say 1 hour.


    Thanks

  2. #2
    Flynax developer John's Avatar
    Join Date
    Oct 2009
    Posts
    606
    Hello Niall,
    Smarty doesn't have such modifier by default but I found some solutions in the web:
    - https://github.com/nZEDb/nZEDb/blob/...er.timeago.php
    - https://gist.github.com/dodyrw/4943269
    - http://www.smarty.net/forums/viewtopic.php?p=61841

    You should create file (modifier) in this dir: /libs/smarty/plugins/modifier.MODIFIER_NAME.php
    and past the modifier code from the sample to the file. After that you may use the modifier as:
    {$listing.Date|MODIFIER_NAME}

    I hope it was clear explanation, let me know if not.
    John

  3. #3
    I like where you going with this
    http://www.smarty.net/forums/viewtopic.php?p=61841 seems to be the best option but Im lost on how to implement this ie how does the modifier script know the age of the listing... Could you please please please help me out on this one. Im sure you could use this feature in your next update.

  4. #4
    Sorry that last message is for john

  5. #5
    Many Thanks John

    This one Worked Perfect

    https://gist.github.com/dodyrw/4943269

    But is There any way to make it work Arabic too?

    Regards
    Ameer

  6. #6
    Quote Originally Posted by Ameer Hassan View Post
    Many Thanks John

    This one Worked Perfect

    https://gist.github.com/dodyrw/4943269

    But is There any way to make it work Arabic too?

    Regards
    Ameer

    Ameer, how did you call the listing date in the .tpl file using the Smarty relative date?

  7. #7
    Quote Originally Posted by Samuel Nduati View Post
    Ameer, how did you call the listing date in the .tpl file using the Smarty relative date?

    Hi Samuel Nduati,

    I make it work now for 2 language English and Arabic
    >>> http://goo.gl/jpTD79 <<<


    Here Are The Steps:-

    1.Go To ----> public_html/libs/smarty/plugins
    And Create file called >>modifier.timeAgo.php<< "note: you can create another one for other language as i did >>modifier.timeAgo-ar.php <<

    Then edit file and paste this code inside it :-
    Code:
    Only registered members can view the code.
    2.Now go to Use This to call the listing date in tpl file --> to Get Full Time use this
    Code:
    Only registered members can view the code.
    And if you want just Time Ago from posting ad use this only:-
    Code:
    Only registered members can view the code.
    3.This one used in listing detail block for category listing block or listing.tpl just use this:
    Code:
    Only registered members can view the code.
    Hope everyone be happy

    My Regards
    Ameer
    Last edited by Ameer Hassan; May 31, 2016 at 12:25 PM.

  8. #8
    Hello Nail,

    You can try to use this code:

    Code:
    Only registered members can view the code.
    in file: ftp://templates>>your_template>>tpl>>blocks>>listing.tpl
    Viktor,
    Flynax technical department,
    Best wishes.

  9. #9
    That code did not work sorry Viktor..

  10. #10
    Change to
    <span> {$listing_data.Date|date_format:$smarty.const.RL_D ATE_FORMAT}</span>

    This One Works

+ Reply to Thread