logo
WSN Links PHP Directory Software
Features Showcase Reviews Demos Purchase Manual Support
 

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

Version:


How remove comments from output
forumsww
Beginner

Usergroup: Member
Joined: Jun 29, 2004
Total Topics: 1
Total Posts: 2
Posted 12/07/04 - 12:42 PM:
quote post
#1
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
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 55
Total Posts: 5796
Posted 12/07/04 - 11:35 PM:
quote post
#2
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.

_____________________
"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founcer of Red Hat
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

Admin Control Panel

   
Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support
© 2008 Paul Knierim. All rights reserved.