News

News

Tuesday 26 June 2007 3:37:33 pm - 7 replies

Author Message

paul bolger

Tuesday 26 June 2007 4:19:40 pm

Hi Kenneth
You'll have to be a bit more specific about what sort of installation you are using. If you have the website interface installed, or the 'news site' package, you just need to take a look at how the example content is being created.

If you want to do this from scratch take a look at http://ez.no/content/download/48190/124975/file/building.pdf for some ideas on how this could be arranged.

Paul Bolger

Kenneth Grande

Wednesday 27 June 2007 1:22:36 am

I'm running ez publish v.3.9.2

Should i make a frontpage or a folder and publish articles, and make a new template so that the content is displayed the way i want (with two columns and a read more link)? I haven't worked with ez before so im trying to figure out where to start

I could not find the "news site" package you mentioned, but if there is such a thing i would really like to have a look at it. Could you send a link?

paul bolger

Wednesday 27 June 2007 11:18:45 pm

The 'news site' package was from the pre-website interface eZ Publish. If you have the Frontpage content class available it sounds like you are running the website interface. I think your best bet would be to try and override one of the templates in there (they are all in extensions folder) unless you can get one of the existing ones to do what you want. I'm pretty sure that one of those 'embedded templates', or whatever they call them, has very similar functionality to what you are looking for.

If you do go down the template override road, a couple of tips:

Work out what template you are looking at by using the Template debug and Inline template debug checkboxes in the admin interface. When you are trying to establish whether it is actually working I'd advise replacing the content of the template with "my template" in red h1 or something until you are sure the override is actually operational - a template can work the same as an SSI. Once you do get the override operating properly you'll find a heap of good examples here:

http://ez.no/doc/ez_publish/technical_manual/3_9/reference/modules/content/fetch_functions/list

Limiting the amount of text displayed can be done by using the 'shorten' operator. Here's an example of a template which does something along the lines of what you want. The '435' is the parent node - the node number of the folder the objects are in. The 'strip tags' stuff is because the field is XML and we don't want it chopping html tags in half when it gets to the 80 character limit. We also don't want it trying to include embedded images, which may look a bit ugly!

{*?template charset=utf-8?*}
{def $highlights=fetch( 'content', 'list',
hash( 'parent_node_id', '435',
'sort_by', array( 'priority', true() ),
'limit', '3'
 ))}

{foreach $highlights as $highlight}
<div class="bighighlight">

<div style="width:{$highlight.object.data_map.image.content.data_map.image.content[bighighlights].width}px">
{attribute_view_gui attribute=$highlight.object.data_map.image image_class=bighighlights}
</div>

<h2>{attribute_view_gui attribute=$highlight.data_map.title| shorten(12)}</h2>

{if $highlight.data_map.intro.has_content}
<p>{strip_tags( $highlight.data_map.intro.value.output.output_text ) | wash | shorten(80, '...', right)}
</p>
{/if}

<a href="{$highlight.object.main_node.url_alias}" title="more about {$highlight.data_map.title.content}">more &#187;</a>

Paul Bolger

Ɓukasz Serwatka

Thursday 28 June 2007 1:11:24 am

Hi,

Bard wrote an article where explains how to build a custom template for a news portal. You may find it useful.

http://ez.no/community/articles/building_a_custom_template_for_a_news_portal

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Kenneth Grande

Thursday 28 June 2007 1:18:08 am

Thank you Paul, that really helped

I got the template override working now, the template debug and template inline debug was a hot tip :)

Kenneth Grande

Thursday 28 June 2007 6:46:18 am

Things are really moving forward :)

Is it possible to apply a template directly to one specific object? I see if i make an override for i.e pagelayout.tpl every page is modified. But i would like to make templates and apply them to specific nodes. I modified the pagelayout to display news, but now i get news on every page on the site. If i could assign a template directly to an object i would not have this problem.

Or perhaps it would be possible to set criterias in the pagelayout template so that it will only display news if it is applied to a certain node, and not when displaying others.

paul bolger

Thursday 28 June 2007 6:55:38 pm

Try something like this, where the node number is the node you want to override. You can also use parent_node, to affect a folder, class_identifier and section.

[frontpagelayout]
Source=pagelayout.tpl
MatchFile=frontpagelayout.tpl
Subdir=templates
Match[node]=373

Paul Bolger

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.