Share » Forums » Developer » [Solved] Problem with embed tag in...

[Solved] Problem with embed tag in XMLBlock

[Solved] Problem with embed tag in XMLBlock

Monday 08 March 2010 7:59:11 am - 5 replies

Modified on Wednesday 17 March 2010 2:27:14 am by Damien MARTIN

Author Message

Damien MARTIN

Monday 15 March 2010 7:30:49 am

Hi there,

It looks like my problem isn't so funny :p

I'm looking at the source code of ezodf and I saw the wonderfull eZContentObject::addContentObjectRelation() method.

I think it could save my life but I still don't understand how to use it.

I created my pictures, stored their content object id and tryed a pretty looking :

$o->addContentObjectRelation($object);

Where $o is the newly created "Article" where my XMLBlock is written.

But it don't still works...

The pictures appears in the related objects but the href attribute of the embed tag is still empty.

NB : I also tryed

$o->addContentObjectRelation($object, false, 0, eZContentObject::RELATION_EMBED);

Could someone help me ?

Thanks in advance,

Damien

Nicolas Pastorino

Monday 15 March 2010 8:26:13 am

$o->addContentObjectRelation($object, false, 0, eZContentObject::RELATION_EMBED);

Hello Damien,

The above looks ok to me, but for the first parameter: you need to pass the object ID, and not the eZContentObject object. What exactly does the $object variable contain in your example ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Damien MARTIN

Monday 15 March 2010 8:57:59 am

Hi Nicolas,

$object is the result of :

$my_object = eZContentFunctions::createAndPublishObject($params);

if($my_object != null)
    return $my_object->ID;

But this part works (I can see the related image in the last panel of the editor "Related objects" ).

My problem is that the href attribute of my ezxml is still empty...

When I update it by hand (disabling "online editor" ), the image is well integrated in my XML Block...

I thought addContentObjectObjectRelation was the solution to my problem, but it looks like eZ do something more and I don't know what.

Thanks,

Damien

Damien MARTIN

Wednesday 17 March 2010 2:26:46 am

Hi there,

I finaly found what was wrong :

When you add the tag for embeding images, you should not use the href attribute, but an object_id attribute.

so :

<embed align="left" view="embed" size="medium" href="ezobject://372"/>

become :

<embed align="left" view="embed" size="medium" object_id="372"/>

And eZ will do everything !!!

Nicolas Pastorino

Wednesday 17 March 2010 3:07:35 am

Wow, that actually rocks.

Thanks for the investigation, i'm sure it will help others :)

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

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

36 542 Users on board!

Forums menu