Forums / Developer / linking to a template

linking to a template

Author Message

dodo dido

Wednesday 25 April 2007 7:13:27 am

heloo there!!i want to ask if it possible to put a link in a template towards linking to another template(not override)?
any idea????

Felix Woldt

Wednesday 25 April 2007 9:22:53 am

hello,

what do you mean?

Do you want for example including in a template the result of content/view/full/2 ?

You can use the template functions

e.g.
{content_view_gui ...}
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/visualization/content_view_gui
or
{node_view_gui ...}
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/visualization/node_view_gui

to include another template

you can use
{inlcude uri=" ... "}
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/miscellaneous/include

greetings
Felix Woldt

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Renaud Patrick

Thursday 26 April 2007 3:03:25 am

Rather than a link pointing to a template, you may deal with a link pointing to an object.

For example, if you want to link the objet "apple" which is in the /fruits directory of your content tree, you may do as follow :

<a href={'/fruits/apple/'|ezurl}>apple</a>

(and of course modify your override.ini so that the right template is used to display your fruits)

Or in your template you fetch the object to link, and use its .url_alias property.

<a href={$apple.url_alias|ezurl}>apple</a>

ez man

Thursday 26 April 2007 5:28:11 am

Hi all
Suppose,I need to change the hardcoded content present in
http://www.example.org/index.php/events/news
How can i do that because there will not be physical file like events/news?
Please let me know in which folder i can edit the contents present in events/news ...

dodo dido

Thursday 26 April 2007 5:44:47 am

thanks you for your help! But what i want is that When user clicks a link (<a>), i want to call a template(ie. .tpl )file. But i want this to accomplish without attaching this template to any of
content class object.Is that posible? Is there any methods?
thanks in advance

ez man

Thursday 26 April 2007 5:52:11 am

Hi Felix or anybody,
I just need to edit the contents present in
"content/view/full/2" dynamically (currently hardcoded content is present)
Can you please suggest on that?
OR
Can you tell where i can see that file where the contents are present as i am new to ezpublish?

Renaud Patrick

Thursday 26 April 2007 6:24:32 am

When user clicks a link (<a>), i want to call a template(ie. .tpl )file. But i want this to accomplish without attaching this template to any of
content class object.Is that posible? Is there any methods?

Ah. I was wondering about the same thing some times ago, and haven't found a solution. It seems to me that accessing something in eZ is always done by looking at an object (node) using some view. If someone has a solution, I'd be glad to read it too.

Suppose,I need to change the hardcoded content present in
http://www.example.org/index.php/events/news
How can i do that because there will not be physical file like events/news?
Please let me know in which folder i can edit the contents present in events/news ...

Try to look into your url translation admin tab, and then in your override.ini, to find which template is linked to this url.

Felix Woldt

Thursday 26 April 2007 8:12:51 am

Ok let's start,

1. enable debug output in your site.ini.append.php here is an example i used for developing ez
ShowUsedTemplates=enabled displays a table with all used template of the requested url.
Have a look ad node/view/full.tpl which template is loaded.

[DebugSettings]
Debug=inline
DebugOutput=enabled
DebugRedirection=disabled
DebugAccess=enabled
DisplayDebugWarnings=disabled
AlwaysLog[]
DebugByIP=enabled
DebugIPList[]=192.168.100.0/24
DebugIPList[]=127.0.0.1
ScriptDebugOutput=enabled

[TemplateSettings]
ShowXHTMLCode=disabled
ShowUsedTemplates=enabled
TemplateCompile=disabled
TemplateCache=disabled
CompileNodePlacements=disabled
CompileExecution=disabled

2. you want to change the template for content/view/full/2/?
It it is a standardtemplate create a new override template for it. In the new Template you can do what you want. You can make your own fetches ...

if you are a beginner have a look to this tutorial http://ez.no/ezpublish/documentation/building_an_ez_publish_site

and ez documentation:
http://ez.no/doc/ez_publish/technical_manual/3_8/templates
http://ez.no/doc/ez_publish/technical_manual/3_8/reference

greetings
Felix Woldt

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Felix Woldt

Thursday 26 April 2007 8:24:08 am

> When user clicks a link (<a>), i want to call a template(ie. .tpl )file. But i want this to
> accomplish without attaching this template to any of
> content class object.Is that posible? Is there any methods?

you can't link to a .tpl file directly!

but you can make a switch if you set viewparameter variables:

content/view/full/2/(myvar)/myvarvalue

in the node/view/full.tpl template which is accessed by this url you have have access to the view_parameter variable 'myvar'

{$view_parameters.myvar}

{$view_parameters|attribute(show)}

have a look in the documentation http://ez.no/doc/ez_publish/technical_manual/3_8/templates/basic_template_tasks

This variable you can use for an 'if' statements and e.g. include other templates or make custom fetches.

hope this will help
Greeting
Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

ez man

Thursday 26 April 2007 8:56:29 am

Thanks Felix!

My contents are stored in design/override/templates in a file called events.tpl
and i have hard coded contents

"Contact us
xyz
+1-666-666-6666(off)
+1-555-555-5555(mobile)"

I want to put this content into ezpublish.
that is to say that contents should be made dynamic so that it is accessible by all users.
(Right now,only me as as admin can access it)

Can you please suggest your ideas?

Felix Woldt

Friday 27 April 2007 12:39:22 am

hi ez man,

if i undstand you right, you want to but the 'Contact us' stuff editable over the admin interface.

For this extend your content class 'event' with a new textfield or a nother ez datatype. Then you can write this information to the content objekt and you can have access on it in the template over e.g {attribute_view_gui ... }

Greetings
Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

ez man

Friday 27 April 2007 6:04:44 am

Thanks Felix!

Exact requirement is:

In news_events we have some items(like contact us ) that are hardcoded and not editable through GUI. Is it possible to run contact info in such a way that it pulls information from somewhere that staff could edit it ?

ez man

Monday 30 April 2007 3:04:20 am

Hi
Any suggestions for my question?

Felix Woldt

Monday 30 April 2007 8:37:28 am

Hi ez man,

yes it is possible to put the contact stuff on a place where somebody can edit it.

For example, create a new Folder with id xyz. Her you place all contentobjects from a custom ContentClass 'Contact Link' which includes your information.

Then you fetch in your Template all this content and you can display in your way you want

{def $list=fetch('content','list',hash('parent_node_id', xyz)}
{$list|attribute(show)}

Best Regards
Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

ez man

Monday 30 April 2007 9:15:09 am

I have a template file called events.tpl in ezpublish/design/events/override/templates
I want to display template contents in http://xyz.com/events_site/event
How do i link these two?

ez man

Monday 30 April 2007 9:20:04 am

"Contact us
xyz
+1-666-666-6666(off)
+1-555-555-5555(mobile)"
is the static content i have in tempate file called events.tpl in ezpublish/design/events/override/templates

Now
I want to display template contents(with above information) in
http://xyz.com/events_site/event
so that edit dynamically.

Felix Woldt

Tuesday 01 May 2007 7:44:32 am

Hi,

You have two choices.
1. if you want to have the same static content in different templates put all your static stuff in a seperate template and include it (dynamically edit not possible)

2. Generate a Contentobjekt of a contentclass whatever you want in the admininterface with your 'static content', remember the 'node_id' of this object and fetch it in every template you want. (dynamically edit possible)

Best regards
Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

ez man

Thursday 03 May 2007 12:17:34 am

Thanks Felix it works great!!

ez man

Thursday 03 May 2007 12:18:42 am

User ID: 1 Username: xyz Email: xyz@hotmail.com Account status: enabled
is what displayed when http://xyz.com/index.php/usr/content/view/full/1123
is seen in browser currently.

Now, i want to add another field 'Usertype' to be displayed after 'Account status: enabled'
Any suggestion on this?

Because in the table 'ezurl' we have only the following columns
contentobject_id
email
login
password_hash
password_hash_type

Suppose i had column 'usertype' in the above table,
how can i add/display value from that table in the url http://xyz.com/index.php/usr/content/view/full/1123

Any help? Felix:)

Felix Woldt

Thursday 03 May 2007 1:16:16 am

Hello,
i don't rearly understand your question. But if you want to display information of a user in a template you can fetch the content of a user ober the user_id. The user_id == contentobject_id.

{def $user_content_object = fetch( 'content', 'object', hash( 'object_id', $contentobject_id )}
{$user_content_object|attribute(show)}

Over the contentobject you can get all information e.g. the mainnodes ...

Greetings Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter