Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
highlighting in PHP
#11
Thanx again Zap. How long you been proggin in PHP? Your advice has been great!
I almost got this thing finsihed!! :king:
Reply
#12
I think, since the summer before last summer. That would be almost 2 years. But it doesn't really matter how long you've been programming in a language, but rather how much. And I've done it quite often Smile
url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Reply
#13
lemme give it a shot...
earn.
Reply
#14
u know i just rememebred yo ucan look at the source to every page on php.net Wink
earn.
Reply
#15
Quote:lemme give it a shot...

eh... what?

Quote:u know i just rememebred yo ucan look at the source to every page on php.net

Cool
url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Reply
#16
now try this:

http://forum.blissdev.com/test1.html

the source for test3.php is:

Code:
<?php
if (!file_exists($_POST['openedfile'])) die('File does not exist.');

$openedfile = implode("",file($_POST['openedfile']));

$openedfile = str_replace($_POST['findword'], "<font class='highlighted'>".$_POST['findword']."</font>", $openedfile);

echo "<style type='text/css'>\r\n<!--\r\n";
echo ".highlighted {background-color: #FFFF00; color: #000000;}";
echo "\r\n</style>\r\n";
echo $openedfile;
?>

i admit it could be shoirter by getting rid of some echoes but i did it this way cuz its easiest for you to impliment
earn.
Reply
#17
i just found out it also highlights your word if is inside a tag (if you type "br" for example) if thats a problem for yo i can make it so that doesnt happen?
earn.
Reply
#18
also if you want it to be case-insensitive, do what he said and change str_replace to the ne wstr_ireplace.
earn.
Reply
#19
Um... thanks Seph. I've finished the script though. It was the first one id ever written in PHP. I think im keen to learn more, bring on the books.....
Reply
#20
u wanna learn more? download any sephforum. thats how jason learned. and he made qb45.com
earn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)