Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts

    Question Dynamic keyword/description parsing

    I am trying to make dynamic keyword/descriptions on my search engine and am wondering what would be the best way to do it. I have 10 results on every page and want the first 3 results in my description tag for seo. Should I parse the html somehow to get what i want or should i try to figure out a way to print the title data names for the first 3 results on the page? I did not write the script I am working with right now so I am getting a bit confused.

  • #2
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    <?php echo "".$title1."" ?> is what is used in the results to display the title name. is there a way use that in my description tag and limit it to the first 3 results?

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Posts
    137
    Thanks
    1
    Thanked 21 Times in 21 Posts
    just echo that title variable in your metatag descriptions inside your head tag.

    <META NAME="Description" CONTENT="<?php echo $title1 ?> ">
    If there are multiple title variables (i don't know since we don't know your code), then perhaps you could add 3 $title variables like so:

    <META NAME="Description" CONTENT="<?php echo $title1 . $title2 . $title3 ?> ">
    This assumes that there is a "$title2" and a "$title2" variable.

    Because sometimes your page results may only have 1 or 2 results or even none, it's perhaps better instead to do it another way. Add the $title1/2/3 variables to another variable like $meta_desc variable and do some error checking so you won't get exception errors if $title2 or $title3 do no exist.

    Hard to give you exact answers without knowing your code.

  • #4
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by pigpen View Post
    just echo that title variable in your metatag descriptions inside your head tag.



    If there are multiple title variables (i don't know since we don't know your code), then perhaps you could add 3 $title variables like so:



    This assumes that there is a "$title2" and a "$title2" variable.

    Because sometimes your page results may only have 1 or 2 results or even none, it's perhaps better instead to do it another way. Add the $title1/2/3 variables to another variable like $meta_desc variable and do some error checking so you won't get exception errors if $title2 or $title3 do no exist.

    Hard to give you exact answers without knowing your code.
    Thanks for your reply even though it was a few days ago. The code that works is
    <?php echo "".$title."" ?> This will display the title anywhere i put it. I cannot however get it to display at all in the HEAD area or anywhere above the search results. How can I make this display above the search results? Do I need to some grab the search information from the very top of the page above the header? Can anyone help out with this. I can provide code if needed. I just really want my description tags to be dynamic. Thanks.

  • #5
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    resolved..
    Last edited by cosmicsea; 11-25-2010 at 02:04 AM.

  • #6
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    Bump. Can someone help me out?


  •  

    Posting Permissions

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