Retrieve Body Tag

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

    #1

    Retrieve Body Tag

    If I have a body tag that looks something like this <body id="home
    page"> where each page on my website has a unique "id", is it possible
    to retrieve the body tag in PHP and pass the id along as a variable?
  • Brendan Donahue

    #2
    Re: Retrieve Body Tag

    Doug Henderson wrote:
    [color=blue]
    > If I have a body tag that looks something like this <body id="home
    > page"> where each page on my website has a unique "id", is it possible
    > to retrieve the body tag in PHP and pass the id along as a variable?[/color]
    The proper way would be to write a regular expression that pulls out that
    part of the page.
    Or you could do something quick-n-dirty, like take the html of the page,
    split() it off at <body id=", then split() it off at "> and put whats in
    between into a variable.

    Comment

    • Doug Henderson

      #3
      Re: Retrieve Body Tag

      Brendan Donahue wrote:
      [color=blue]
      > The proper way would be to write a regular expression that pulls out that
      > part of the page.
      > Or you could do something quick-n-dirty, like take the html of the page,
      > split() it off at <body id=", then split() it off at "> and put whats in
      > between into a variable.[/color]

      Thanks, Brendan. Could you (or anyone else) give me a code snippet
      showing how to do that?

      Comment

      • Fred the man

        #4
        Re: Retrieve Body Tag

        On Sun, 18 Apr 2004 06:34:39 -0400, Doug Henderson
        <dch1963@adelph ia.net> wrote:[color=blue]
        >Thanks, Brendan. Could you (or anyone else) give me a code snippet
        >showing how to do that?[/color]





        Fred.

        Comment

        Working...