FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Thorny string translation issue.
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Thorny string translation issue. [message #180797 is a reply to message #180795] Tue, 19 March 2013 11:45 Go to previous messageGo to previous message
BootNic is currently offline  BootNic
Messages: 10
Registered: November 2010
Karma:
Junior Member
In article <ki9bcd$gu7$1(at)news(dot)albasani(dot)net>, The Natural Philosopher
<tnp(at)invalid(dot)invalid> wrote:

>> The Natural Philosopher wrote:

>>> I want the user to enter raw text and embedded HTML into a database.
>>> No trouble with getting it in, but when getting it out, it needs
>>> massaging for display..

>>> Now I cant find a function in the library that will skip html styles
>>> like <b>...</b> or <a...></a> code, and yet still tranlsatee e.g. '>'
>>> to '&gt;' etc etc.

[snip]

> Specifically consider the example

> <b> <= </b>

> where I want to display a bold 'arrow'

http://php.net/manual/en/book.tidy.php

function tUp($content) {
$config = array(
'indent' => 0,
'output-html' => 1,
'wrap' => 0,
'doctype' => 'strict',
'sort-attributes' => 'alpha',
'output-encoding' => 'utf8',
'char-encoding' => 'utf8'
);
if (extension_loaded("tidy")) {

$tidy = new tidy;
$tidy->parseString($content, $config, 'utf8');
$tidy->cleanRepair();
$body = $tidy->Body();
$content = $body->value;
$content = trim(preg_replace("`<(/)?body>`", "", $content));

}
return $content;
}
print tUp('<b> <= </b>');

[snip]



--
BootNic Tue Mar 19, 2013 07:45 am
The only thing wrong with immortality is that it tends to go on forever.
*Herb Caen*
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Hot list for BA/QA- Load Runner, Software Tester, Business Analyst/ Project Coordinator & SAP Business Object Developer
Next Topic: split array and string from string (trust me it will make sense when you read)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 05:28:43 GMT 2024

Total time taken to generate the page: 0.04649 seconds