Share » Forums » Setup & design » relations in xml text

relations in xml text

relations in xml text

Friday 20 January 2006 2:39:12 am - 3 replies

Author Message

Xavier Dutoit

Friday 20 January 2006 1:14:52 pm

I made this extension extactly for the need you discribe.

http://ez.no/community/contribs/template_plugins/getobjects_extension

The name of the tag (object) has changed on 3.6, you'd have to update the code. That's simple, but I don't have the time to do it and test it... but I'd be more than happy to add the modification you're going to do on it ;)

You can find it on pubsvn too.

X+

http://www.sydesy.com

Ben Pirt

Tuesday 24 January 2006 11:18:22 am

Thanks Xavier,
Great extension and absolutely perfect for my needs. Hopefully it will be included in eZ before too long. As suggested I made some changes, which were basically to check for dom elements called "embed" and to also check if they have an attribute of "object_id". So the function "modify" is now as follows:

function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
    {
        if (!isset($namedParameters['xmlattribute']->DataText))
            return "should be an attribute";
         
        $xmldata =& $namedParameters['xmlattribute']->DataText;
        $xml = new eZXML();
        $dom =& $xml->domTree( $xmldata );
        if ( is_object ($dom) )
        {
            $objects =& $dom->elementsByName( "embed" );
            foreach ($objects as $object)
            {
                $attributes=& $object->attributes();
                foreach ($attributes as $attribute)
                {
                    if ($attribute->Name == "object_id")
                        $operatorValue[] = $attribute->content;
                } 
            }
        }
    }

I haven't done a check for the eZ version, but this is working perfectly on my 3.6 installation.

Thanks again,

Ben Pirt

Xavier Dutoit

Wednesday 25 January 2006 12:05:59 am

Thanks for your contrib,

I've modified it so it's compatible both with 3.5 and 3.6.
That's on pubsvn and on the contrib area too;

Could you test with your config and tell me if it's ok ?

X+

http://www.sydesy.com

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu