Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Mods and contribution Discussion

Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum.

Closed Thread
 
Thread Tools Display Modes
Old 09-30-2005   #1
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default Show Listing Dates

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}
[Added Date] can be called in the template using {$date_added}
[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!
VSDan is offline  
Old 09-30-2005   #2
yktan
 
Join Date: Jun 2005
Posts: 353
Default

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}
yktan is offline  
Old 09-30-2005   #3
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default

[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!
VSDan is offline  
Old 09-30-2005   #4
suzkaw
 
Join Date: Sep 2005
Posts: 13
Default

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"}
__________________
Thanks,
Eric
http://68kb.com
suzkaw is offline  
Old 10-02-2005   #5
ing
 
Join Date: Sep 2005
Posts: 90
Default

Thanks Eric,

I just tried adding the code you suggested to my site and it works great.

Cheers
__________________
Work At Home Directory
ing is offline  
Old 10-02-2005   #6
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default

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
Ap0s7le is offline  
Old 11-25-2005   #7
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

Quote:
Originally Posted by suzkaw
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"}
where must i add this code ? (and can i change it in german ?)
thompson is offline  
Old 12-12-2005   #8
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

*push* i dont understand where the smarty code comes into.

is that the complete code ?
thompson is offline  
Old 12-12-2005   #9
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default

thompson,

Where do you want it to show?

-Casey
__________________
Casey Wilson / Ap0s7le
Freelance Programmer
http://www.ap0s7le.com
Need help with PHPLD? PM me
Ap0s7le is offline  
Old 12-13-2005   #10
Sxperm
Supporter
 
Join Date: Dec 2005
Posts: 154
Send a message via ICQ to Sxperm Send a message via MSN to Sxperm
Default

Hi all, I edited following your instruction but no date appeared to my links. What I did wrong? ops:
Sxperm is offline  
Old 12-13-2005   #11
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

Quote:
Originally Posted by Ap0s7le
thompson,

Where do you want it to show?

-Casey
behind the links of each category.
thompson is offline  
Old 12-13-2005   #12
ing
 
Join Date: Sep 2005
Posts: 90
Default

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>
Change it to..

Code:
{$link.DESCRIPTION}
Added: {$link.DATE_ADDED|date_format:"%A, %B %e, %Y"}</p>
Hope that helps.

__________________
Work At Home Directory
ing is offline  
Old 12-13-2005   #13
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

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 ?
thompson is offline  
Old 12-14-2005   #14
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default

Try this
Code:
{$link.DATE_ADDED|date_format:"%d.%m.%Y"}
-Casey
__________________
Casey Wilson / Ap0s7le
Freelance Programmer
http://www.ap0s7le.com
Need help with PHPLD? PM me
Ap0s7le is offline  
Old 12-14-2005   #15
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

thanks casey, it works.
thompson is offline  
Old 12-14-2005   #16
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default

That's great thompson.

Best of luck

-Casey
__________________
Casey Wilson / Ap0s7le
Freelance Programmer
http://www.ap0s7le.com
Need help with PHPLD? PM me
Ap0s7le is offline  
Old 01-01-2006   #17
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

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.
thompson is offline  
Old 03-10-2006   #18
posiver
 
Join Date: Mar 2006
Posts: 1
Default So you can add date in details

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
posiver is offline  
Old 07-06-2006   #19
CyberGrenade
 
Join Date: Jul 2006
Posts: 13
Default Thanks

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!
__________________
http://www.cybergrenade.com

I also enjoy photography.
CyberGrenade is offline  
Old 07-15-2006   #20
Jama62
Supporter
 
Jama62's Avatar
 
Join Date: Feb 2006
Location: South Cali
Posts: 155
Default

Thanks for the mod
Jama62 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:59 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.