Jump to content

idk


ki

Recommended Posts

Umm it could probably be done with JS a bit better, since it would look at the entire parsed page, but you could use

[code=php:0]
<style type="test/css">
.highlight {
background-color: yellow;
}
</style>

<?
$rep = $_GET['highlight'];
//lets pretend some how the entire contents of the page are $contents
str_replace($rep, "<font class='hightlight'>{$rep}</font>", $contents);
?>

[/code]

That script assumed that the entire contents of the page is in $contents, and it would create problems if a user chose to high light something like < cause then it would make it <font class='highlight'><</font> which wouldnt be a problem unless it changed something like <img src="image.jpg"> into <font class='highlight'><</font> src=...

You could probably use regexps to make sure it wasnt in an html tag... Anyways, someone will probably post with a better answer than mine, but I tried :p.
Link to comment
https://forums.phpfreaks.com/topic/32140-idk/#findComment-149151
Share on other sites

[quote author=bljepp69 link=topic=120230.msg492976#msg492976 date=1167360460]
You have to use some kind of function to accomplish this.  Check out this post -
[url=http://www.phpfreaks.com/forums/index.php/topic,119892.msg491766.html#msg491766]http://www.phpfreaks.com/forums/index.php/topic,119892.msg491766.html#msg491766[/url]
[/quote]
that worked, but i modified it so it replaces the < > and checks to see it theres still any thing to high light, and thorpe, thats what I was thinking of at first
Link to comment
https://forums.phpfreaks.com/topic/32140-idk/#findComment-149165
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.