CodeIgniter Forums
typography class & and & - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: typography class & and & (/showthread.php?tid=18272)



typography class & and & - El Forum - 04-30-2009

[eluser]Flying Fish[/eluser]
I'm using codeigniter for an app that generates xml files which are then imported into Adobe inDesign.

Users input data into form inputs, the data is stored in a db, and an administrator can log into the back end and download xml files.

Trouble is, inDesign chokes on the '&' character when it sits in the text of the xml tags.

inDesign does however correctly handle the html &

I was wondering if I should write a function that does a string replace on '&' before each xml file is created, or if there was a more fancy codeigniter way of doing it with the typography class.


typography class & and & - El Forum - 04-30-2009

[eluser]Dam1an[/eluser]
When you say the HTML &, do you mean & amp ;?
One of the text/typography helpers can probably do that, as I'm pretty sure one of them converts stuff like <, > etc to & lt ;, & gt ; etc

Edit: Added some spaces in the HTML chars


typography class & and &amp; - El Forum - 04-30-2009

[eluser]Flying Fish[/eluser]
yes sorry, the html ampersand

Code:
&amp;

had to wrap it in code tags


typography class & and &amp; - El Forum - 04-30-2009

[eluser]Dam1an[/eluser]
Hmm.. Can't find anything for & amp ; in the typography helper/class
This should be good enough

Code:
str_replace("&", "&amp;", $my_string_with_ampersands);



typography class & and &amp; - El Forum - 04-30-2009

[eluser]Flying Fish[/eluser]
ya I didn't see anything in there either, but figured it was worth an ask, thanks for the reply