Module .tpl issue

Author Message

Ivan Švogor

Friday 01 October 2010 1:52:30 am

Hello,

I'm having an issue creating new module. I follow step of the tutorial and I'm having trouble loading the .tpl file. I create the extension folder, corresponding php wich works. It display test echo message, but when I try to bind it with .tpl file, it says something like:

No template could be loaded for "modul1/list.tpl" using resource "design"

This is inside my extension, the path is: [http root]newez\extension\jacextension\design\standard\templates\modul1\list.tpl

But when I put this tpl file in the base design, it works, so it's in the path [http root]\newez\design\base\templates\modul1\list.tpl

What am I doing wrong? - How can I place this template in my extension, so this file is used, not the one I put in base design?

Mario Ivancic

Friday 01 October 2010 3:19:54 am

Hi Ivan,

- When you create newmodulename in your newextension here are examples how the path ways looks like:

For newmodulename:

extension/newextension/modules/newmodulename/list.php

For list.tpl path :

 extension/newextension/design/newextension/templates/modulname/list.tpl

Then when you call template in list.php do it like this:

 $template = "design:newmodulename/list.tpl";

--
http://www.escapestudio.net
http://twitter.com/MarioIvancic

Ivo Lukac

Friday 01 October 2010 4:44:39 am

Just replying to have 3 Croats in one thread ;)

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Frédéric DAVID

Friday 01 October 2010 5:17:39 am

"

For list.tpl path :

 extension/fat/design/fat/templates/modulname/list.tpl
"

Hi,

If you want to have your design on your front end and your back end, you have to create your template in a design called standard.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Quoc Huy Nguyen Dinh

Friday 01 October 2010 8:16:34 am

Just to check... have you cleared the cache?

Ivan Švogor

Sunday 03 October 2010 10:20:22 am

"

Hi Ivan,

- When you create newmodulename in your newextension here are examples how the path ways looks like:

For newmodulename:

extension/newextension/modules/newmodulename/list.php

For list.tpl path :

 extension/newextension/design/newextension/templates/modulname/list.tpl

Then when you call template in list.php do it like this:

 $template = "design:newmodulename/list.tpl";
"

Hello, thank you for your reply.

I've done exacley that and nothing. I even named my folder as standard design. It just doesn't take the .tpl file from within the module but from the one in root/ezpublish/design..

Am I missing something? (version is 4.x)

Christian Rößler

Sunday 03 October 2010 10:52:38 am

Have you setup your extension to serve designs/templates?

extension/newextension/settings/site.ini.append.php

[TemplateSettings]
ExtensionAutoloadPath[]=newextension

Then put your template in

extension/newextension/design/standard/templates/somefolder/list.tpl

and you can refer to it in your module-php-code via

$tpl = templateInit();
$tpl->setVariable('foo', $foo); 
$templateResult = $tpl->fetch( 'design:somefolder/list.tpl' ); 

$Result = array();
$Result['content'] = $templateResult;

That should it be.

Chris.

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613

Christian Rößler

Sunday 03 October 2010 11:05:34 am

Addition Info: If you want to provide a new DESIGN (besides standard) and in this design provide templates, do this:

Create the following directory structure:

extension/newextension/design/foo/templates
extension/newextension/design/foo/stylesheets
extension/newextension/design/foo/javascript
extension/newextension/design/foo/images

Put your design ressources (js, css, img) into the proper directories.

Put your Template into

extension/newextension/design/foo/templates/somefolder/list.tpl

And change/edit/add the following ini files:

extension/newextension/settings/site.ini.append.php
[TemplateSettings]
ExtensionAutoloadPath[]=newextension

and

extension/newextension/settings/design.ini.append.php
[ExtensionSettings]
DesignExtensions[]=newextension

At last, make eZPublish do recognize the design "foo" by doing the following in your override site.ini or your siteaccess site.ini...

Override site.ini:

settings/override/site.ini.append.php
[ExtensionSettings]
ActiveExtensions[]=newextension

[DesignSettings]
SiteDesign=foo

Or when using the siteaccess site.ini:

settings/siteaccess/<NAME OF SITEACCESS HERE>/site.ini.append.php
[ExtensionSettings]
ActiveAccessExtensions[]=newextension

[DesignSettings]
SiteDesign=foo

That should do the trick

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613

Ivan Švogor

Monday 04 October 2010 4:27:19 am

Thank you for your reply, it works now. Maybe something in my ini was not right. But I also formated them in UTF-8 format, and reloaded autogenerate arrays...Maybe it was that. But I also changed ini files, so thank you. It works and that's what matters :)

There is still one more question. How can I use this module as a class? - So I can let my users to insert this module. It's not a very elegant solution to have just a link.

How is this normaly done in ezPublish?

Cheers

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

eZ debug

Timing: Jan 18 2025 02:18:44
Script start
Timing: Jan 18 2025 02:18:44
Module start 'layout'
Timing: Jan 18 2025 02:18:44
Module start 'content'
Timing: Jan 18 2025 02:18:45
Module end 'content'
Timing: Jan 18 2025 02:18:45
Script end

Main resources:

Total runtime0.9743 sec
Peak memory usage4,096.0000 KB
Database Queries84

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.9141152.6094
Module start 'layout' 0.00520.0019 741.523439.4375
Module start 'content' 0.00700.9657 780.9609803.1953
Module end 'content' 0.97270.0015 1,584.156324.1875
Script end 0.9742  1,608.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3241160.0002
Check MTime0.00130.1382160.0001
Mysql Total
Database connection0.00080.078610.0008
Mysqli_queries0.880790.3938840.0105
Looping result0.00100.1076820.0000
Template Total0.945997.120.4729
Template load0.00210.217420.0011
Template processing0.943896.866020.4719
Template load and register function0.00020.016210.0002
states
state_id_array0.00090.090110.0009
state_identifier_array0.00120.127720.0006
Override
Cache load0.00210.2112880.0000
Sytem overhead
Fetch class attribute can translate value0.00080.086260.0001
Fetch class attribute name0.00130.1309130.0001
XML
Image XML parsing0.00230.234860.0004
class_abstraction
Instantiating content class attribute0.00000.0020130.0000
General
dbfile0.00140.1389370.0000
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
30content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
17content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
2content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
2content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 69
 Number of unique templates used: 10

Time used to render debug report: 0.0002 secs