Links will not work with ' or "

e107 CMS » Forums » e107 Code » Plugin / Code Developer Discussion << Previous thread | Next thread >>
Cliffo
Aug 27 2011, 04:58PM
Registered Member #55601
Joined: Apr 14 2010, 08:15PM
Posts: 39
I made a plugin to allows admins to set various variables I use in my themes (was created from the YourFirstPlugin). The ones that allow the user to enter content, for example I have an option to enter content into the footer, the links will not work.

If I put in a link <a href='linkURL'>Link</a> it will put it in the footer as <a href="%27linkURL%27">Link</a>

If I put in a link <a href="linkURL">Link</a> it will put it in the footer as <a href="%22linkURL%22">Link</a>

BUT, if I put in a link <a href=linkURL>Link</a> (no ' or " around the link URL) it works just fine.

Here are some snippets of code as an example of how I coded this in the plugin;

<tr> <!-- Footer Content -->
				<td class='tborder' style='width: 200px'>
					<span class='smalltext' style='font-weight: bold'>
						".NBW_OPT_THE_04."
					</span>
				</td>
				<td class='tborder' style='width: 200px' valign='top'>
					<input class='tbox' size='35' type='text' name='nbw_theme_options_opt_the_04' value='".$pref["nbw_theme_options_opt_the_04"]."' />
				</td>
			</tr>


$pref['nbw_theme_options_opt_the_04']        = $tp->toDB($_POST['nbw_theme_options_opt_the_04']);



and then I add it into the theme as a theme shortcode, here is the contents of the .sc file;

if($pref["nbw_theme_options_opt_the_04"]) {
	$ret = $pref["nbw_theme_options_opt_the_04"];
	}

return $ret;


Any ideas why this happens and how I can fix it?
[ Edited Aug 27 2011, 07:15PM ]
Go to top
septor
Aug 27 2011, 05:11PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #37
Joined: Aug 11 2002, 03:20AM
Location: United States
Posts: 2689
Firstly, change:

if($pref["nbw_theme_options_opt_the_04"] && $pref["nbw_theme_options_opt_the_04"] !== "") {


To

if($pref["nbw_theme_options_opt_the_04"]) {


The second part isn't needed (it's saying the same thing, more or less).

Your problem may reside in this here:

<input class='tbox' size='35' type='text' name='nbw_theme_options_opt_the_04' value='".$pref["nbw_theme_options_opt_the_04"]."' />


More specifically:

value='".$pref["nbw_theme_options_opt_the_04"]."'


Try this instead:

value='".$pref['nbw_theme_options_opt_the_04']."'
.

If that doesn't fix it I'm going to need to see more of the file you are posting those snippets from.
Go to top
Website
Cliffo
Aug 27 2011, 05:34PM
Registered Member #55601
Joined: Apr 14 2010, 08:15PM
Posts: 39
That didnt seem to help, I tried ".$pref["nbw_theme_options_opt_the_04"]." ".$pref['nbw_theme_options_opt_the_04']." and ".$pref[nbw_theme_options_opt_the_04]." in both the plugin and theme.

Inside the database <a href="linkURL">Link</a> is stored as <a href=& quot;linkURL& quot;>Link</a> (without the space between & and quot;

How show I transfer the file for you to see?
[ Edited Aug 27 2011, 05:36PM ]
Go to top
septor
Aug 27 2011, 06:56PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #37
Joined: Aug 11 2002, 03:20AM
Location: United States
Posts: 2689
So, I'll blame this on lack of cake.

You need to run the information through the toHTML() function for it to display correctly. (Sorry I missed this!).
Go to top
Website
Cliffo
Jan 24 2012, 06:26AM
Registered Member #55601
Joined: Apr 14 2010, 08:15PM
Posts: 39
That is not working and nothing else I have tried is working.
Go to top
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System