Embedding related objects

Author Message

Vivienne van Velzen

Thursday 30 September 2004 2:58:14 am

Hi all,

I'm trying to place a link to a pdf-document as an inline element in my text. To this end, I've created an embed_class_XX.tpl override template (with the line {set-block scope=root variable=is_block}false{/set-block}). However,

1) When I place the following sentence in my inputfield: 'Click here to view the pdf-file' (with the link under 'here'), EZpublish automatically places a br-tag before the link (which kinda ruins the inline effect)
2) When I place two links in my inputfield: 'first pdf-file' and 'second pdf-file' with empty lines between them (hard returns in the inputfield), EZpublish places them besides eachother (and ignores the hard return).

I'd be much obliged if anyone could help me with these problems.
TIA,

Vivienne

Vivienne van Velzen

Friday 08 October 2004 2:34:11 am

Anyone? I'd really appreciate it (I'm still hoping it's at least possible).

Mark Marsiglio

Friday 08 October 2004 5:10:20 am

eZ uses templates for everything - and all of them can be overridden. Try turning on template debug:

[TemplateSettings]
Debug=enabled

in your site.ini.append in your site access.

With this enabled, I usually have to clear the cache the hard way to get the output to work. I delete the var/mysite/cache folder and force eZ to rebuild the cache. For some reason, even then it takes a while for all of the templates to be named.

You will see the name and location of the template that is putting the br-tag into your embedded PDF. Open that template, take out the br, and then save it in the same folder structure, but this time in your design/mysite/override folder.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Vivienne van Velzen

Friday 08 October 2004 7:01:14 am

Mark, thanks for your reply, but I'm still having problems. The main one is that the template that I apparently need to override is 'line.tpl', because EZpublish places objects automatically on the next line. And I can't do that because of the implications for the rest of my site (seeing as line.tpl is pretty much used everywhere).
For instance, I place the following text in my XML-field and publish ('omstandigheden' is one word):

<i>ziekte of sociaal-economische omstandig<object id="320" />heden.</i>

EZPublish apparently places a <br> tag <b>AFTER</b> 'omstandig', so even if I override the object-template (which I have), it still comes out as:

<i>ziekte of sociaal-economische omstandig
<object id="320" />heden.</i>

And when I go back to my XML-field to check, that's how it's shown as well (even though I originally placed it all on one line). So my real problem here is: how do I get EZpublish to NOT end the line at the beginning of an object?
TIA,

Vivienne

Vivienne van Velzen

Monday 11 October 2004 4:00:06 am

Once again, can anyone help me with this problem? What I'm trying to achieve seems pretty basic (to me), but I can't get it to work. It's incredibly frustrating, as you might imagine. Any help would be appreciated.
TIA,

Vivienne

Mark Marsiglio

Monday 11 October 2004 5:46:02 am

The offending file seems to be the design/standard/templates/content/datatype/view/ezxmltags/line.tpl

Did you try taking out the <br> and seeing what happens?

One way to handle it may be to change this file to

<span class="line">{$content}</span>

Then you could use CSS to change the span to have a clear:right or to be a block element when it's parent object matches a certain criteria. For instance, if it is a child of the .folder-view-line element, it could be displayed as block.

I might be shooting in the dark here, but that is the best that I could come up with.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Vivienne van Velzen

Friday 15 October 2004 4:34:47 am

Hi Mark,

Once again thanks for replying. I have tried to alter the line.tpl file. When I remove the <br> tag there, it's also removed before my object. BUT, doing this removes other <br> tags that are correct as well. So that's not an option.

I'll try to do something with stylesheets, although at the moment I'm pretty skeptic whether that'll work. In my opinion it's not whether or not the text is shown as inline or block, but that EZPublish treats the text before an object as a seperate line-object and uses the line.tpl template for the text up to the object (which is why changing line.tpl works). Even though the (reference to the) object (in my case) is part of the text and should be on the same line. I might have to find a way to parse the content of XML field in my page to find out if an object reference is present, and if so, to remove the <br> tag before it. I'll let you know how I get along.

But in the meantime.... aarghhhh! How can this be so hard!?! Has no-one had the same problem (which I can't really imagine)? If so, and you've found a solution, PLEASE let me know.
TIA,

Vivienne

Vivienne van Velzen

Monday 18 October 2004 11:58:05 pm

It's me again. Sorry if I'm starting to bug people, but I really like to get this to work.
Could it have something to do with the way the XML input text is stored in the database? Because when I go back to the editpage, the object is placed on its own line, even though I placed it inline before 'publishing'. And why do two objects always get placed side by side, even though I put a hard return between them in the input field?
Anyone?

Vivienne

Norman Leutner

Tuesday 19 October 2004 12:42:12 am

Take a look into the DB
Table:ezcontentobject_attribute
and look for your contentobject_id.
Within the data_text column you can find the xml which is written into the Database.

But before you should check your .css file and look for margin within paragraphs.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Vivienne van Velzen

Wednesday 20 October 2004 4:06:48 am

Hi Norman,

I checked the XML saved in the database and it's the following:

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
         xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
         xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
  <paragraph>
    <line>ziekte of sociaal-economische omstandig</line>
    <object id="320" />heden.</paragraph>
</section>

As you can see, an </line> has been added before the object, even though I placed the object on the same line in the XML input field. I tried to figure out where this is done, but I'm not proficient enough with EZPublish code.
More help would be appreciated.

Vivienne
PS. As the text and the object are placed within the same paragraph, margins within my stylesheet for a paragraph object don't make any difference.

Norman Leutner

Wednesday 20 October 2004 4:16:04 am

You can find them under kernel/classes/datatype/ezxmltext/

As you can see, the html <br> is inserted after the xml </line>
Thats correct.

If you want so get rid of that <br> you should create a template override (line.tpl) for that node / section.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Vivienne van Velzen

Wednesday 20 October 2004 5:44:42 am

Hi Norman,

Of course, placing a <br> after the xml </line> is correct. I just don't want that </line> to be placed before an object reference if I don't specifically do that myself in the XML input field. When I click 'publish', EZPublish places the </line> before the object reference and I can't figure out where (or why) EPublish does that (automagically). Does anyone know this?

Vivienne

Wenyue Yu

Friday 22 October 2004 2:08:03 am

Hi,

The reason is that eZ publish treat <object> as block tag. We have changed this in eZ publish 3.5.
You can fix for previous version by editing file kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinput.php.

In the end of this file, change the following three lines:

 var $BlockTagArray = array( 'table', 'ul', 'ol', 'literal', 'custom', object' );
 var $InLineTagArray = array( 'emphasize', 'strong', 'link', 'anchor', 'line', 'underline' );
 var $LineTagArray = array( 'emphasize', 'strong', 'link', 'anchor', 'li', 'underline');

to

 var $BlockTagArray = array( 'table', 'ul', 'ol', 'literal', 'custom' );
 var $InLineTagArray = array( 'emphasize', 'strong', 'link', 'anchor', 'line', 'underline', 'object' );
 var $LineTagArray = array( 'emphasize', 'strong', 'link', 'anchor', 'li', 'underline', 'object' );

The changes is moving object tag from block tag array to inline and line tag array. Hope it will work for you.

Regards,
wenyue

Vivienne van Velzen

Friday 22 October 2004 4:28:25 am

Hi Wenyue,

Wow, you really are a lifesaver today. I made the changes you suggested and it works perfectly. Thanks a million, trillion, gazillion!!

Vivienne

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.