Forums / Developer / Module .tpl issue

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

eZ debug

Timing: Jan 18 2025 00:08:20
Script start
Timing: Jan 18 2025 00:08:20
Module start 'content'
Timing: Jan 18 2025 00:08:21
Module end 'content'
Timing: Jan 18 2025 00:08:21
Script end

Main resources:

Total runtime0.9305 sec
Peak memory usage4,096.0000 KB
Database Queries221

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 588.7422180.8516
Module start 'content' 0.00620.8061 769.5938808.2578
Module end 'content' 0.81230.1181 1,577.8516344.4453
Script end 0.9304  1,922.2969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3688210.0002
Check MTime0.00130.1409210.0001
Mysql Total
Database connection0.00080.090910.0008
Mysqli_queries0.830789.27172210.0038
Looping result0.00220.24142190.0000
Template Total0.907397.520.4536
Template load0.00190.202420.0009
Template processing0.905497.297220.4527
Template load and register function0.00030.028110.0003
states
state_id_array0.00070.079910.0007
state_identifier_array0.00100.104620.0005
Override
Cache load0.00180.1917880.0000
Sytem overhead
Fetch class attribute can translate value0.00120.127770.0002
Fetch class attribute name0.00160.1751130.0001
XML
Image XML parsing0.00330.352170.0005
class_abstraction
Instantiating content class attribute0.00000.0026130.0000
General
dbfile0.00350.3725480.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 69
 Number of unique templates used: 10

Time used to render debug report: 0.0001 secs