Webmastersite.net
Register Log In

How remove comments from output
How to remove comments that might downgrade you.

Comments on How remove comments from output

forumsww
Beginner

Usergroup: Member
Joined: Jun 29, 2004

Total Topics: 1
Total Comments: 2
Posted Dec 07, 2004 - 12:42 PM:

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.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Dec 07, 2004 - 11:35 PM:

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.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.