Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 1st Dec 2011, 06:52 PM   #1
Active Warrior
 
iisark's Avatar
 
Join Date: 2011
Posts: 42
Thanks: 2
Thanked 18 Times in 12 Posts
Default
How to add < href to PHP?
Share on: 
fb share twitter share gplus share more share

Hi to all,
I need help with this line of code
$data[1]["Category"]["body"] = str_replace("[!LOCATION!]", $data[2]["Location"]["name"], " ".$data[1]["Category"]["name"]." text text text ".$data[1]["Category"]["name"]." text text text");

I want to add <href link to this line of code (where the "text" words are),so it shoud look something like this:

$data[1]["Category"]["body"] = str_replace("[!LOCATION!]", $data[2]["Location"]["name"], " ".$data[1]["Category"]["name"]." text text LINK GOES HERE text ".$data[1]["Category"]["name"]." text text text");

I added: "LINK GOES HERE" beacuse i 'm not allowed to post links

But when i add the link,my site collapse
Can you please help me with that?
iisark is offline  
Unread 1st Dec 2011, 08:17 PM   #2
HyperActive Warrior
War Room Member
 
ussher's Avatar
 
Join Date: 2010
Location: Tokyo
Posts: 314
Thanks: 27
Thanked 43 Times in 42 Posts
Default
Re: How to add < href to PHP?
Share on: 
fb share twitter share gplus share more share

The code you have there looks for ['!LOCATION'] and if it finds that text it replaces it with the value in the $data[2]["Location"]["name"]

please explain "my site collapse"

If its a fixed link that doesn't change im guessing that your issue is probably non-escaped quotes.

the " are stuffing things up because <a href="link to someoehrere">the link</a> has quotes in it.

Try using single quotes ' or escaping them with a backslash (depending on what language it is)
<a href=\"link to someoehrere\">the link</a>

"Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."
- jamroom.net
Download Jamroom free: Download
ussher is offline  
Unread 2nd Dec 2011, 01:18 AM   #3
Active Warrior
 
Join Date: 2011
Posts: 60
Thanks: 0
Thanked 4 Times in 4 Posts
Default
Re: How to add < href to PHP?
Share on: 
fb share twitter share gplus share more share

Yes. There are many ways. One of them is:

<html>
<?php
echo '<b>' . htmlspecialchars( $name ) . '</b>,<br />';
echo 'Sorry there's a problem sending your message. ';
echo 'Please <a href="/mail.html">try again</a>.';
?>
</html>

another:

<html>
<b><?php htmlspecialchars( $name ); ?></b>,<br />
Sorry there's a problem sending your message.
Please <a href="/mail.html">try again</a>.
</html>

rainso0 is offline  
Closed Thread


Bookmarks

Tags
<, add, href, php


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 07:25 AM.