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
Share on other sites

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]
Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.