469,925 Members | 1,485 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

Date Auto-Update on Save Dreamweaver/PHP

Just wondering if any of you knew of a way to trap the <!-- #BeginDate
format:Am1 -->April 4, 2006<!-- #EndDate --> (Dreamweaver's
Auto-Update-on-Save Date Code) into a PHP variable and still have the
Date update on save? Or really any way to have a variable with the
updated date stored when the file is saved is what i'm looking for,
this just seemed like a possible solution.

Something to the effect of:

<?php
$saved_date = '<!-- #BeginDate format:Am1 -->April 4, 2006<!-- #EndDate
-->';
?>

or

<?php
$saved_date = ' ?> <!-- #BeginDate format:Am1 -->April 4, 2006<!--
#EndDate --> <?php ';
?>

But Dreamweaver skips over the code when it's embedded in the php in
the first example, and the second i'm sure would cause a compile error.

Apr 4 '06 #1
5 7843
<? ob_start();?><!-- #begin dreamweaver stuff --><?
$date=ob_get_clean() ?>

Though, its sketchy that dreamwaver will parse the stuff. I've never
gotten it to work reliably, sometimes it works, sometimes it doesn't.
I just stick a 'last updated' variable at the top of the file or very
bottom so i don't forget. You could also using the 'last modified'
file attribute, but that might be altered by other things.

Apr 5 '06 #2
NC
mb*******@gmail.com wrote:

Just wondering if any of you knew of a way to trap the <!-- #BeginDate
format:Am1 -->April 4, 2006<!-- #EndDate --> (Dreamweaver's
Auto-Update-on-Save Date Code) into a PHP variable and still have the
Date update on save?


Why bother? Just use the file system functions:

$saved_date = date('F j, Y', filectime(__FILE__));

Cheers,
NC

Apr 5 '06 #3
On Tue, 04 Apr 2006 20:47:10 -0700, NC wrote:
Just wondering if any of you knew of a way to trap the <!-- #BeginDate
format:Am1 -->April 4, 2006<!-- #EndDate --> (Dreamweaver's
Auto-Update-on-Save Date Code) into a PHP variable and still have the
Date update on save?


Why bother? Just use the file system functions:

$saved_date = date('F j, Y', filectime(__FILE__));


But you probably want to use filemtime not filectime. The date of the
last save, not the date the file was created on.

Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Apr 5 '06 #4
ah! exactly what i was looking for, but i wasn't even aware of the
filetime commands. thanks.

Apr 5 '06 #5
NC
Andy Jeffries wrote:
On Tue, 04 Apr 2006 20:47:10 -0700, NC wrote:

Why bother? Just use the file system functions:

$saved_date = date('F j, Y', filectime(__FILE__));
But you probably want to use filemtime not filectime.


You're right... Where was my head? :)
The date of the last save, not the date the file was created on.


On this one, though, I think you're a bit off... On most Unix systems,
there is no such thing as file creation time. There is only the time
of last file change; a file is considered changed when its inode data
(permissions, owner, group, etc.) is changed.

Cheers,
NC

Apr 5 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Richard Hollenbeck | last post: by
2 posts views Thread by Gale | last post: by
2 posts views Thread by Edwin Knoppert | last post: by
2 posts views Thread by musosdev | last post: by
2 posts views Thread by bml337 via AccessMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.