Hi,
I need to have various words throughout a site that I’m building made clickable. For example lets say I have AXO and ROB how can I make these become automatic links or even pop up div’s when moused over as they turn up in the various places throughout the site. Is there some regular expression that I need to use? I have never done this at all and would appreciate any advice as to how I can set this up. Keep in mind I’m still very new this all this.
Many thanks
Brian
making words hyperlinks
Moderator: General Moderators
I have never done this before, but I would imagine this is the logic.
1. Build an array of words to be hyperlinked. and links to go to
2. Get the page text content into a variable. IE: $textcontent
3. Perform a str_replace() on the content
perhaps something like this
1. Build an array of words to be hyperlinked. and links to go to
2. Get the page text content into a variable. IE: $textcontent
3. Perform a str_replace() on the content
perhaps something like this
Code: Select all
$words = array(
'word1' => 'http://www.word1.com',
'word2' => 'http://www.word2.com',
'word3' =>'http://www.word3.com'
);
$content = $database['content'] // or however else you grab the content
foreach($words AS $k=>$v){
$content = str_replace($k,"<a href=\"$v\" target=\"_blank\">$k</a>",$content);
}Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Yes. You will have to specify which words you want to become active in the array.
Unless you're looking for the bbcode [ url ] function(s)?
Unless you're looking for the bbcode [ url ] function(s)?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.