How to use custom template?

How to use custom template?

Wednesday 09 June 2010 9:11:20 am - 5 replies

Modified on Wednesday 09 June 2010 9:12:03 am by Steven Stieng

Author Message

Steven Stieng

Wednesday 09 June 2010 9:56:22 am

UPDATE

I changed the INI file to this:

[page_article]
Source=node/view/full.tpl
MatchFile=page_article.tpl
Subdir=templates

And by moving my article_page.tpl to override/templates/ folder, the template is shown.
But my debug output still gives me some errors like:

Error: eZTemplate @ extension/ezwebin/design/ezwebin/override/templates/page_article.tpl:12[12]
Cannot retrieve attribute of a string

Error: eZTemplate @ extension/ezwebin/design/ezwebin/override/templates/page_article.tpl:19[8] Jun 09 2010 18:50:49
Cannot retrieve attribute of a string

The code in page_article.tpl is identical to the code in article.tpl

What could cause these errors?

André R.

Wednesday 09 June 2010 11:24:54 am

That highly depends on what you have on line 12 and 19 in that template (So yes, always post the lines of code you have issues with so people can help you, what code is on which line changes from version to version, so always post the line in question and a few lines above and bellow if it seems to be several lines involved in what ever happens on the lines something breaks).

Looked in full/article.tpl in webin, but there are no tpl code on line 12 so guess you made some changes. Additionally, if your class is different then article class, that probably explains it as well.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Steven Stieng

Thursday 10 June 2010 1:50:16 am

Sorry about that. I thought it might have something to do with some configuration. There is a lot of that in here :)
Yes, I have done a few changes. This is my code and starts at line 8:

{if $node.data_map.image_large.has_content}
    <img id="articleImageLarge" class="floatLeft" src={$node.data_map.image_large.content["original"].full_path|ezroot} alt="" />
{elseif $node.data_map.image.has_content}
    <img id="articleImage" class="floatLeft" src={$node.data_map.image.content["original"].full_path|ezroot} alt="" />
 {/if}

I'm using exact same code for article.tpl and it works fine.

Another question: Do I always have to override some template when I create a new tempalte_name.tpl file?

PS. Doing a {$node.data_map.image|attribute(show, 1)} gives me a lot of info.
So accessing the attribute is not the problem.

 

Steven Stieng

Thursday 10 June 2010 1:59:57 am

Ok, I've done some more research.

This code works and outputs the intro text:

{attribute_view_gui attribute=$node.data_map.intro}

But using this code gives me an error: 

{if $node.data_map.intro.content.is_empty|not}
    <div class="articleIntro">
      {attribute_view_gui attribute=$node.data_map.intro}
    </div>
{/if}
 

The error  is on the first line {if $node.data_map.intro.content.is_empty|not}.
Error message:

Cannot retrieve attribute of a string

 

Steven Stieng

Thursday 10 June 2010 3:06:36 am

Ok, new information.

For this template, the following code is wrong:
{if $node.data_map.intro.content.is_empty|not}

This code works:
{if $node.data_map.intro.has_content}

And for some reason, the test for the images works too, even though I haven't done anything.

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

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