Linked Keywords
Posted on
16th Feb 2014 07:03 pm by
admin
I am trying to get a script that makes my predefined keyword converted to links and / or converted to a certain color, size and so on... In one of the other threads Ive posted I got an answer I am a bit curious on, I'll just quote the answer, and hopefully some of you can help me with this.... see my answer below, and help If you want... I'll be forever grateful....
QuoteQuote from: Grayda on Today at 12:26:29 AM
I think I get it. You want certain words to be, say, red. And you want other words to be made in to a link? I think this should help:
Code:
<?php$mytext = "Buffalo with an aqualung";$mytext = str_replace("Buffalo", "<a href='buffalo.php'>Buffalo</a>", $mytext);$mytext = str_replace("aqualung", "<b>aqualung</b>", $mytext);echo $mytext
So when you run the script, Buffalo will be replaced with a link to buffalo.php and aqualung will be made bold.
That, of course, is the simple way to do it. You can get complex with regexes and whatnot, but if you're only doing a few things at a time, this is ideal.
bah.. Im still struggling with this... could anyone be helpful explaining to me how I can use this example in my site? I don't understand a thing, and probably shouldn't be messing with this kind of codes.. lol...
Before my text that needs to be converted I have three other pages included:
<?php include "../url/url.php"; ?>
<?php include "url.php"; ?>
<?php include "url/url.php"; ?>
These makes the top of my pages, and I was hoping that I could set the code in one of those so I don't have to copy&paste the script into every single page...
Don't I need any more script than those few lines?
Im desperate.... lol.... please help...
No comments posted yet
Your Answer:
Login to answer
210
51
Other forums
PHP File Upload Problem
Hi, I have written a very simple file upload script but it fails for reasons I can't explain. Hope
Delete all files in folder except with certain name
I have a script that I want to delete all files in a folder (taken from a database) except for one n
Am i doing this wrong?
Im pulling from an Oracle database some info... one of which is a field count_pnums which is a NUMBE
Certain files upload, while others do not
I want to read the data from an uploaded file. Not sure why, but it only uploads for certain files.
problems with php variables in mysql query
i can't seem to get the following query to work.
select $q1c from $vote_rate where id = $re
upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t
Help? Need help on project with templates involving mysql and php.
I'm having a hard time explaining what I want but basically here is what I have in place:
-Da
Need help with cin setw
I made a program here is my code:
#include
#include
#i
DOMDocument parsing
Hello, I am parsing an xml file from an API which I have converted into a DOMDocument in php. This i
wav to mp3 + goDaddy
I need to convert wav files to mp3s. From what I have found so far one way to do it is to have my PH