![]() |
| |||||||
| Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum. |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | This mod will allow you to show [Added Date] and/or [Last Modified Date] for listings: At the top of templates/link.tpl, add the following: Code: {assign var="date_added" value=$link.DATE_ADDED}
{assign var="date_modified" value=$link.DATE_MODIFIED}
[php]
$parts = preg_split("/ /", $this->get_template_vars('date_added'));
$parts = preg_split("/-/", $parts[0]);
$this->assign('date_added', date("M-d-Y", mktime(0, 0, 0, $parts[1], $parts[2], $parts[0])));
$parts = preg_split("/ /", $this->get_template_vars('date_modified'));
$parts = preg_split("/-/", $parts[0]);
$this->assign('date_modified', date("M-d-Y", mktime(0, 0, 0, $parts[1], $parts[2], $parts[0])));
{/php} [Last Modified Date] can be called in the template using {$date_modified} __________________ Dan █ Unlock the Vault Contest :: Over $350 Prizes! █ phpLD Mods :: phpLD_Vault █ Webmaster Resources Directory █ phpLD_Vault Support IMPORTANT NOTE: phpLD_Vault Support not handled in this forum AND not via PM here. Click on link above for support. NO exceptions! |
| |
| | #2 |
| Join Date: Jun 2005 Posts: 353 | I think [php] should read {PHP} instead. VSDan are you using Windows? I need something like this instead: Code: {assign var="date_added" value=$link.DATE_ADDED}
{assign var="date_modified" value=$link.DATE_MODIFIED}
[php]
list($year,$month,$day,$hour,$minute,$seconds) = sscanf($this->get_template_vars('date_added'),'%4s%2s%2s%2s%2s%2s');
$this->assign('date_modified', date('Y-m-d', mktime($hour,$minute,$seconds,$month,$day,$year)));
{/php} __________________ Greatest fear in a coder\'s world: A minute bug with correct syntax. {link removed from sig as the account seemed to be suspended} |
| |
| | #3 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | [quote="yktan"]I think [php] should read {PHP} instead. Good eye, thanks for the correction! I thought about adding time, but decided to stick with just date. Hmm, was not aware of the 'sscanf' PHP function. Much better =) Thanks! I'm more of a CGI programmer (date functions are more limited in CGI-Perl - although external modules open the doors more). __________________ Dan █ Unlock the Vault Contest :: Over $350 Prizes! █ phpLD Mods :: phpLD_Vault █ Webmaster Resources Directory █ phpLD_Vault Support IMPORTANT NOTE: phpLD_Vault Support not handled in this forum AND not via PM here. Click on link above for support. NO exceptions! |
| |
| | #4 |
| Join Date: Sep 2005 Posts: 13 | Hey guys why not just use the smarty date_format? It would save you from having to do all that coding to format the date. http://smarty.php.net/manual/en/lang...ate.format.php Code: {$link.DATE_ADDED|date_format:"%A, %B %e, %Y"} |
| |
| | #5 |
| Join Date: Sep 2005 Posts: 90 | Thanks Eric, I just tried adding the code you suggested to my site and it works great. Cheers __________________ Work At Home Directory |
| |
| | #6 |
| I thought the same thing suzkaw, also using {php} tags in a template are frowned upon ![]() later -Casey __________________ Casey Wilson / Ap0s7le Freelance Programmer http://www.ap0s7le.com Need help with PHPLD? PM me | |
| |
| | #7 | |
| Supporter Join Date: Oct 2005 Posts: 548 | Quote:
| |
| |
| | #8 |
| Supporter Join Date: Oct 2005 Posts: 548 | *push* i dont understand where the smarty code comes into. is that the complete code ? |
| |
| | #9 |
| thompson, Where do you want it to show? -Casey __________________ Casey Wilson / Ap0s7le Freelance Programmer http://www.ap0s7le.com Need help with PHPLD? PM me | |
| |
| | #10 |
| Supporter | Hi all, I edited following your instruction but no date appeared to my links. What I did wrong? ops: |
| |
| | #11 | |
| Supporter Join Date: Oct 2005 Posts: 548 | Quote:
| |
| |
| | #12 |
| Join Date: Sep 2005 Posts: 90 | Hi, You can add that code into link.tpl wherever you want it to appear. For example, if you want the date to appear on a new line below the link description and have the words "Date Added:" or "Added:" before the date, you would do this.. Find.. Code:
{$link.DESCRIPTION}</p> Code:
{$link.DESCRIPTION}
Added: {$link.DATE_ADDED|date_format:"%A, %B %e, %Y"}</p> __________________ Work At Home Directory |
| |
| | #13 |
| Supporter Join Date: Oct 2005 Posts: 548 | thanks it works. but the date format is english ( Monday, November 28, 2005 ) in german there is Montag 28. November 2005 better 28.11.2005 can you change this ? |
| |
| | #14 |
| Try this Code: {$link.DATE_ADDED|date_format:"%d.%m.%Y"} __________________ Casey Wilson / Ap0s7le Freelance Programmer http://www.ap0s7le.com Need help with PHPLD? PM me | |
| |
| | #15 |
| Supporter Join Date: Oct 2005 Posts: 548 | thanks casey, it works. |
| |
| | #16 |
| That's great thompson. Best of luck -Casey __________________ Casey Wilson / Ap0s7le Freelance Programmer http://www.ap0s7le.com Need help with PHPLD? PM me | |
| |
| | #17 |
| Supporter Join Date: Oct 2005 Posts: 548 | how does it works on other pages than link.tpl ? i build it in another page, but it didn´t work. ||solved __________________ many thanks. thompson. |
| |
| | #18 |
| Join Date: Mar 2006 Posts: 1 | Hello, i have found this directory last night, and it is wonderfull. You must add the follwing in your details.php Find this: $data['RATE_ENABLED'] = $rdata['RATE_ENABLED']; After it in a new line add this: $data['DATE_ADDED'] = $rdata['DATE_ADDED']; Add this where you will lokk the date: {$DATE_ADDED|date_format:"%d.%m.%Y"}</td> That is all. The date is in german style For english date use this line: {$DATE_ADDED|date_format:"%A, %B %e, %Y"} Have a lot of fun :wink: Posiver |
| |
| | #19 |
| Join Date: Jul 2006 Posts: 13 | Thanks for the Mod. This has lead to a lot of changes for my site. I used this to add a NEW icon to listings that have been added in the last 14 days. Thanks! |
| |
| | #20 |
| Supporter Join Date: Feb 2006 Location: South Cali Posts: 155 | Thanks for the mod |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|