Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: News Manager & Job Manager:
Substite special chars in $name$ placeholder

 

 


compubase
User

Jan 31, 2005, 7:23 AM

Post #1 of 3 (5028 views)
Shortcut
Substite special chars in $name$ placeholder Can't Post

Hi all,

For a client, we have setup the NM to publish the index file as a php file for advanced features.
For example:
<?php
$name = '$name$';
?>

The problem now is when a single quote is entered in the name field, the php file cannot be parsed because the genereated index file will than look like:
<?php
$name = 'News article name with a quote(')';
?>

Is there a way to subsitute special chars like quotes to theire HTML equivalent?

Thanks for your help!

Joep


ross
Staff / Moderator


Feb 1, 2005, 11:28 AM

Post #2 of 3 (5020 views)
Shortcut
Re: [compubase] Substite special chars in $name$ placeholder [In reply to] Can't Post

Hi Joep.

Thanks for posting!

I can think of a couple different things for you to try.

The first would be to add a \ before each of your single quotes. This will generally cancel out the significance that the character that it’s before. In this case, it would cancel out the fact that a single quote ends a text string.

The second one would be to substitute in the html value for a single quote. It would be &#39; The single quote should get translated back to a ‘ when it’s being used on a page.

Could you give either of these a shot and let me know how it works out?

If you have any questions, don’t hesitate to let me know Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



compubase
User

Feb 1, 2005, 11:49 AM

Post #3 of 3 (5018 views)
Shortcut
Re: [ross] Substite special chars in $name$ placeholder [In reply to] Can't Post

Thanks Ros for your reply,

I found the solution by using heredocs funtionality:

<?php
$name = <<<EOD
$name$
EOD;
?>

Joep