SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: parse html data

  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    parse html data

    Hi Guys,

    I need to parse the following html data and replace the $dtphrase[] array with a different variable. How would I do that?

    PHP Code:
    <title>$dtphrase[site_title]</title

  2. #2
    SitePoint Evangelist anjanesh's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $html '
    <html>
    <title>$dtphrase[site_title]</title>
    </html>
    '
    ;
    $title "SitePoint";
    $html preg_replace('#<title>(\$dtphrase\[site_title\])</title>#is''<title>'.$title.'</title>'$html);
    echo 
    '<pre>'.htmlentities($html).'</pre>'
    Anjanesh

  3. #3
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Dont think that's what im looking for...

    Just want to replace the '$dtphrase[site_title]'

  4. #4
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    809
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use this pattern:
    PHP Code:
    /'\$dtphrase\[site_title\]/i' 

  5. #5
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What if 'site_title' is not always the pattern?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •