Dynamic Expires Meta tag

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steven

    Dynamic Expires Meta tag

    Hi there,

    I have a database with documents that have event dates included. What I need
    to do is have the Expires META tag to be one day after that event date.

    Can I get the date from the appropriate field in the database and format it
    into GMT to add into the header() function?

    Cheers

    Steven


  • Michael Fesser

    #2
    Re: Dynamic Expires Meta tag

    .oO(Steven)
    [color=blue]
    >I have a database with documents that have event dates included. What I need
    >to do is have the Expires META tag to be one day after that event date.[/color]

    You don't need a meta-element, use an Expires header instead.
    [color=blue]
    >Can I get the date from the appropriate field in the database and format it
    >into GMT to add into the header() function?[/color]

    Yep. According to RFC 2616 (HTTP 1.1) the date has to be in a form like
    this to be valid for the Expires header:

    Thu, 01 Dec 1994 16:00:00 GMT

    Micha

    Comment

    • Steven

      #3
      Re: Dynamic Expires Meta tag

      Hi there,

      Yes, sorry I meant the expires header. These documents used to be hand coded
      and so the expires date was update manually.

      What I need now is a way of populating the expires header with data from the
      database.

      Can this be done???

      Cheers

      Steven
      "Michael Fesser" <netizen@gmx.ne t> wrote in message
      news:bhiom0t6iq 7kph3oimmr2daod tq1ol5tol@4ax.c om...[color=blue]
      > .oO(Steven)
      >[color=green]
      > >I have a database with documents that have event dates included. What I[/color][/color]
      need[color=blue][color=green]
      > >to do is have the Expires META tag to be one day after that event date.[/color]
      >
      > You don't need a meta-element, use an Expires header instead.
      >[color=green]
      > >Can I get the date from the appropriate field in the database and format[/color][/color]
      it[color=blue][color=green]
      > >into GMT to add into the header() function?[/color]
      >
      > Yep. According to RFC 2616 (HTTP 1.1) the date has to be in a form like
      > this to be valid for the Expires header:
      >
      > Thu, 01 Dec 1994 16:00:00 GMT
      >
      > Micha[/color]


      Comment

      • Michael Fesser

        #4
        Re: Dynamic Expires Meta tag

        .oO(Steven)
        [color=blue]
        >What I need now is a way of populating the expires header with data from the
        >database.
        >
        >Can this be done???[/color]

        Sure, just fetch your date from the database (as Unix timestamp if
        possible), format it with date() or strftime() and use the header()
        function to create the Expires header.

        Micha

        Comment

        Working...