Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Php help needed

  1. #11
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    The reason that I put http://kywordpro.com/txt/1/10/toast.html was so you could see that the test.php was pulling all the descriptions on that page

  2. #12
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    the test.php page uses this code

    PHP Code:
    <?php 
    include 'simple_html_dom.php'
    $html file_get_html('http://kywordpro.com/txt/1/10/toast.html'); 
    foreach(
    $html->find('td[name=desc]') as $e
        echo 
    $e->plaintext
    ?>
    but I want to put this on the same page as http://kywordpro.com/txt/1/10/toast.html and it put all the search descriptions and put them in the meta tag.

    Does this make sence?

  3. #13
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Replace:
    PHP Code:
    <meta name="description" content="<?php echo $e->plaintext;?>">
    With:
    PHP Code:
    <meta name="description" content="
    <?php  
    include 'simple_html_dom.php';  
    $html file_get_html('http://kywordpro.com/txt/1/10/toast.html');  
    foreach(
    $html->find('td[name=desc]') as $e)  
        echo 
    $e->plaintext;  
    ?>
    ">
    Jeremy | jfein.net

  4. #14
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Nile I think you missed the question.

    Go to http://kywordpro.com then in the search type anything you want.

    You will notice that the site address will change to http://kywordpro.com/txt/1/10/{YOUR SEARCH TERM}.html

    So I cant use $html = file_get_html('http://kywordpro.com/txt/1/10/toast.html'); because the page address changes for every term you search.

    I want the search results descriptions to print in my meta tag for that page.

  5. #15
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Ok, in the top of your page put:
    PHP Code:
    include 'simple_html_dom.php';  
    $html file_get_html("http://kywordpro.com/txt/1/10/".$q.".html");
    $v = array();
    foreach(
    $html->find('td[name=desc]') as $e) { 
        
    $v[] = $e->plaintext;
    }
    $v implode(""$v); 
    Then in the meta part, put:
    PHP Code:
    <?php
    echo $v;
    ?>
    Last edited by Nile; 03-06-2009 at 10:11 PM.
    Jeremy | jfein.net

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
  •