TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-14-2008, 05:44 AM   #1 (permalink)
The Prestige
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 852
Thanks: 31
delayedinsanity is on a distinguished road
Default XML noob

Okay, so I built a language pack using a PHP array, very simple, no hit to my speed, works really well. Then I read this: TalkPHP - The Framework Basics of Creating Multilingual PHP Applications

So I figured, even though I don't understand why using XML is that much better than the method I've already employed (no speed gains, anyways), I'd give it a go. I got it working fine, except for one small thing... two of my phrases include HTML, and that breaks the whole thing. Not the HTML itself, but apparently adding any kind of attribute to an HTML element seems to break it.

Code:
<phrase id="admin_module_failed">The specified administrative module could not be loaded:<br /><span style=\"font-weight: normal;\">%s</span></phrase>
<phrase id="admin_module_not_found">The specified administrative module could not be found:<br /><span style="font-weight: normal;">%s</span></phrase>
If I remove the span, it works. Since these are the only two phrases I do this on, I could easily remove it from both, but I don't really want to. So how do I incorporate this into an xml phrase file without the whole thing busting down? I'd post the error, but just having one of these phrases in the file produces literally two pages of errors.
-m
delayedinsanity is offline  
Reply With Quote
Old 07-14-2008, 08:29 AM   #2 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 836
Thanks: 31
sketchMedia is on a distinguished road
Default

try wrapping the elements test in a <![CDATA[ ]]> tag, because xml elements can have sub elements the parser will look inside your phrase element for '<' then interpret them as XML, CDATA tells the parser to ignore it.

XML CDATA
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
The Following 2 Users Say Thank You to sketchMedia For This Useful Post:
delayedinsanity (07-14-2008), webid (07-14-2008)
Old 07-14-2008, 01:10 PM   #3 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Also, another way around it is to actually use the encoded format of hte html your trying to use.

Code:
<phrase id="admin_module_failed">The specified administrative module could not be loaded:&lt;br /&gt;&lt;span style=\"font-weight: normal;\"&gt;%s&lt;/span&gt</phrase>
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-14-2008, 02:49 PM   #4 (permalink)
The Prestige
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 852
Thanks: 31
delayedinsanity is on a distinguished road
Default

That did the trick, thanks sketch.
-m
delayedinsanity is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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


All times are GMT. The time now is 08:21 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design