...

View Full Version : Dynamic keyword/description parsing



cosmicsea
11-20-2010, 12:49 AM
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.

cosmicsea
11-20-2010, 01:18 AM
<?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?

pigpen
11-20-2010, 06:34 AM
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.

cosmicsea
11-23-2010, 07:58 PM
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.

cosmicsea
11-23-2010, 08:05 PM
resolved..

cosmicsea
11-24-2010, 09:48 PM
Bump. Can someone help me out?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum