0

hi,
i'm developing this small seo component, i want to know how it should be done. now i'm writing seo meta tags and other tags search engines looking into the page. i'm getting the content of the page and look for the previous set of say, keywords and replacing them with the new set. and same for the other tag, but i have a problem here. if the page contains same text in another place , it will be replaced too. hope you can give me a solution for this. thanks in advance.

3
Contributors
9
Replies
10
Views
5 Years
Discussion Span
Last Post by Virangya
0

You need to give your code unless you're using str_replace.

If you are using str_replace, since meta tags are above everything else, you can make use of the optional count parameter as per manual:
mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

0

No idea what you need. Print your code and highlight the areas that your need sorted. In general - ensure that you have a querystring or htaccess rewrite equivalent for SEO.

0

You need to give your code unless you're using str_replace.

If you are using str_replace, since meta tags are above everything else, you can make use of the optional count parameter as per manual:
mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

hi , most of the times its <link> tags, since in need them too

$replace1=str_replace('href="'.$arr['nextpagehid'].'"','href="'.$arr['nextpage'].'"',$replace1);
$replace1=str_replace('href=\''.$arr['nextpagehid'].'\'','href=\''.$arr['nextpage'].'\'',$replace1);

if i do it as you say, do i have to replace in an array and array count parameter equal to one? can you please explain it a bit further?

0

No idea what you need. Print your code and highlight the areas that your need sorted. In general - ensure that you have a querystring or htaccess rewrite equivalent for SEO.

please see my reply for the code.

0

No. Just replace

$replace1=str_replace('href="'.$arr['nextpagehid'].'"','href="'.$arr['nextpage'].'"',$replace1);
$replace1=str_replace('href=\''.$arr['nextpagehid'].'\'','href=\''.$arr['nextpage'].'\'',$replace1);

with

$replace1=str_replace('href="'.$arr['nextpagehid'].'"','href="'.$arr['nextpage'].'"',$replace1,1);
$replace1=str_replace('href=\''.$arr['nextpagehid'].'\'','href=\''.$arr['nextpage'].'\'',$replace1,1);
0

No. Just replace

$replace1=str_replace('href="'.$arr['nextpagehid'].'"','href="'.$arr['nextpage'].'"',$replace1);
$replace1=str_replace('href=\''.$arr['nextpagehid'].'\'','href=\''.$arr['nextpage'].'\'',$replace1);

with

$replace1=str_replace('href="'.$arr['nextpagehid'].'"','href="'.$arr['nextpage'].'"',$replace1,1);
$replace1=str_replace('href=\''.$arr['nextpagehid'].'\'','href=\''.$arr['nextpage'].'\'',$replace1,1);

oo hou, had no idea that str_replace has another parameter, thanks a lot tiggsy..!!!

0

hey i got this error <b>Fatal error</b>: Only variables can be passed by reference in

0

ok. paste in your code on the lines that it says the error is

i found out , that 4th parameter is an out parameter..
i can use preg_replace to limit it that way. am i right?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.