Thursday 21 August 2008 12:54:49 pm
Hi, I'm using eZ Publish 4.0 and I've to fill the eZXMLtext attribute of an object with HTML data. But I'm unable to add custom tags. Example :
$mystring = "Hello, this is <b>bold</b> and this is <XXX>a factbox</XXX>, ...";
$parser = new eZSimplifiedXMLInputParser( $contentObjectID, false, 0 );
$document = $parser->process( $mystring );
then I got that in the XMLtext attribute :
Hello, this is <strong>bold</strong> and this is a factbox, ...
Well, the parser converts the tag "B" into "STRONG" because of the public variable $InputTags in the class eZSimplifiedXMLInputParser. Take a look :
class eZSimplifiedXMLInputParser extends eZXMLInputParser
{
var $InputTags = array(
'b' => array( 'name' => 'strong' ),
....
I've tried to redefine InputTags by adding "XXX" => array("name" => "factbox") but nothing happened. Who can see a solution ?
And, afterwards, how to handle parameters of custom tags?
Let's say I've a custom tag named "img" with parameters "src" and "alt", my template file is OK and I'm able to create that custom tag in the editor (it appears as a blue rectangle) and when I publish it all is OK, the image is displayed as expected. However, importing the following code with PHP fails miserably.
$mystring = "This is <b>bold</b> and that is an image : <img src="http://URLofAnImage" alt="alternative text" />";
Any idea? Thanks in advance.
TOMHTML, French user of eZ Publish.
|