How do you get to remove the comment tags from the pages that denote the start and end of a section of links. I think it looks bad if ti says somthing like start of reciplinks. Search engines might downgrade your site.
Search engines couldn't care less, but open end.php and replace $totalpage = str_replace('', '', $totalpage); // perhaps replace with function to remove all comments with $totalpage = stripcomments($totalpage); function stripcomments($source)
{
$tokens = token_get_all($source);
foreach ($tokens as $token)
{
if (is_string($token))
{
// simple 1-character token
$data .= $token;
}
else
{
// token array
list($id, $text) = $token;
switch($id)
{
case T_COMMENT:
case T_ML_COMMENT:
// no action on comments
break;
default:
// anything else -> output "as is"
$data .= $text;
break;
}
}
}
return $data;
}
Note, however, that this requires PHP 4.3.0+ to work.
0/5
1
2
3
4
5
This thread is closed, so you cannot post a reply.
Comments on How remove comments from output
Beginner
Usergroup: Member
Joined: Jun 29, 2004
Total Topics: 1
Total Comments: 2
How do you get to remove the comment tags from the pages that denote the start and end of a section of links. I think it looks bad if ti says somthing like start of reciplinks. Search engines might downgrade your site.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Search engines couldn't care less, but open end.php and replace $totalpage = str_replace('', '', $totalpage); // perhaps replace with function to remove all comments with
$totalpage = stripcomments($totalpage);
function stripcomments($source)
{
$tokens = token_get_all($source);
foreach ($tokens as $token)
{
if (is_string($token))
{
// simple 1-character token
$data .= $token;
}
else
{
// token array
list($id, $text) = $token;
switch($id)
{
case T_COMMENT:
case T_ML_COMMENT:
// no action on comments
break;
default:
// anything else -> output "as is"
$data .= $text;
break;
}
}
}
return $data;
}
Note, however, that this requires PHP 4.3.0+ to work.