Date Auto-Update on Save Dreamweaver/PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mbyrd1332@gmail.com

    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.

  • Richard Levasseur

    #2
    Re: Date Auto-Update on Save Dreamweaver/PHP

    <? ob_start();?><!-- #begin dreamweaver stuff --><?
    $date=ob_get_cl ean() ?>

    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.

    Comment

    • NC

      #3
      Re: Date Auto-Update on Save Dreamweaver/PHP

      mbyrd1332@gmail .com wrote:[color=blue]
      >
      > 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?[/color]

      Why bother? Just use the file system functions:

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

      Cheers,
      NC

      Comment

      • Andy Jeffries

        #4
        Re: Date Auto-Update on Save Dreamweaver/PHP

        On Tue, 04 Apr 2006 20:47:10 -0700, NC wrote:[color=blue][color=green]
        >> 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?[/color]
        >
        > Why bother? Just use the file system functions:
        >
        > $saved_date = date('F j, Y', filectime(__FIL E__));[/color]

        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

        Comment

        • mbyrd1332@gmail.com

          #5
          Re: Date Auto-Update on Save Dreamweaver/PHP

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

          Comment

          • NC

            #6
            Re: Date Auto-Update on Save Dreamweaver/PHP

            Andy Jeffries wrote:[color=blue]
            > On Tue, 04 Apr 2006 20:47:10 -0700, NC wrote:[color=green]
            > >
            > > Why bother? Just use the file system functions:
            > >
            > > $saved_date = date('F j, Y', filectime(__FIL E__));[/color]
            >
            > But you probably want to use filemtime not filectime.[/color]

            You're right... Where was my head? :)
            [color=blue]
            > The date of the last save, not the date the file was created on.[/color]

            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

            Comment

            Working...