Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Embed HTML Code into PHP date string?
Old 07-09-2010, 08:30 PM Embed HTML Code into PHP date string?
Super Talker

Posts: 117
Trades: 0
I have been using a simple content management system for the last several years and a new feature I am hoping to add to my website is problematic.

Simply put, I am hoping to style the date with a CSS sprites display.

The trouble is the CMS does not really allow the styling of dates because the date in a template is displayed using a single {date} tag which is only configurable by changing the PHP date string.

Rather than change CMS systems and try to convert 1400 posts, I am hoping I can add some HTML into the config file and consequently the date string.

Assuming this was no problem as is, the code would look something like this.
Code:
<div class="postdate">
<div class="month F">F</div>
<div class="day d">d</div>
<div class="year Y">Y</div>
</div>
I have found that you can escape each character of literal text but that doesn't seem to work for code. I am not particularly familiar with PHP so if anyone knows how this could be done I would be very appreciative.
__________________

Please login or register to view this content. Registration is FREE
| nx2000 at gmail | AIM - tagmisterb
Mr. B is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-09-2010, 08:36 PM Re: Embed HTML Code into PHP date string?
Marik's Avatar
Skilled Talker

Posts: 99
Trades: 0
I probably misunderstood what you're looking for but is this what you mean:

PHP Code:
<div class="postdate">
<div class="month F"><?php echo date(F); ?></div>
<div class="day d"><?php echo date(d); ?></div>
<div class="year Y"><?php echo date(Y); ?></div>
</div>
__________________

Please login or register to view this content. Registration is FREE
Marik is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 08:46 PM Re: Embed HTML Code into PHP date string?
Super Talker

Posts: 117
Trades: 0
The code will have to be on a line of the CMS config file, which currently reads:
Code:
$datefor = 'F d, Y';
Just putting my html in there interprets every character as part of the date string.
__________________

Please login or register to view this content. Registration is FREE
| nx2000 at gmail | AIM - tagmisterb
Mr. B is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 09:16 PM Re: Embed HTML Code into PHP date string?
Marik's Avatar
Skilled Talker

Posts: 99
Trades: 0
Pretty sure passing html through the date function's acceptable parameters is impossible. I would just change all instances of date($datefor) to the code I posted above. But why would you have to change 1400 posts, don't you have a single template that all posts use? Does this CMS use a database?
__________________

Please login or register to view this content. Registration is FREE
Marik is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 09:23 PM Re: Embed HTML Code into PHP date string?
Super Talker

Posts: 117
Trades: 0
I use fusion news, which uses flat files. I will try to fool with the function though, thanks.
__________________

Please login or register to view this content. Registration is FREE
| nx2000 at gmail | AIM - tagmisterb
Mr. B is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Embed HTML Code into PHP date string?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26180 seconds with 12 queries