How to display more than 1 object in 1 clic ?

Author Message

laurent le cadet

Thursday 28 August 2003 11:41:23 pm

Even if eZ P don't make the coffee, It's very open and powerfull to do nearly what ever we want.

But I'm not sure it's possible to display 2 differents objects in 1 clic...
I have a main menu on the left of the screen with links to info pages {$module_result.content} and a cell just below with a generic image. What I want to do is to change both the image and the info page in the same clic...

Thanks for help.

Bjørn Kaarstein

Friday 29 August 2003 12:18:47 am

You could try to use the element view, something like this.

{section loop=fetch('content', 'list', hash('parent_node_id', $node.node_id,'class_filter_type', include, 'class_filter_array', array(2,8)))}

{node_view_gui view=element content_node=$:item}

{/section}

Here you fetch out instances of class 2 & 8. Now you can write overrides for element.tpl for both classes, and you'll have two changes in one click.

Hope this helps.

Regards Bjørn

laurent le cadet

Friday 29 August 2003 1:03:38 am

Thanks for repplying.

Actually I'm basically sorting contents like this :

{let article_list=fetch( content, list, hash( parent_node_id, 188, sort_by, array( array( priority )) ) )}

With the links like this :

{section name=Article loop=$article_list}
<a class="small" href={concat( "/content/view/full/", $Article:item.node_id,"/" )|ezurl}>{$Article:item.name|wash}</a>
{/section}

But I don't see How I can adapt your manner to my problem. It's not rather luminous for me.

More help ?

laurent.

laurent le cadet

Friday 29 August 2003 2:34:17 am

I wish I was born developper but I just have a designer brain.
I know I'm a bit greedy but it's the last step for a new eZ site...
May someone take my hand ?

Bjørn Kaarstein

Friday 29 August 2003 3:49:50 am

The image you're referring to... How is this loaded? Is it a static image like {<img src="pic.jpg"|ezimage>}, or do you fetch it from a class?

If you want to show a different picture for the different articles, you could use a switch/case statement matching on node.

Let's say you have articles with node_id 100, 101, 102 etc..

{switch match=$node.node_id}
{case match=100}
<img src={"pic_node_100.jpg"|ezimage}>
{/case}

{case match=101}
<img src={"pic_node_101.jpg"|ezimage}>
{/case}

{case}
<img src={"default_pic.jpg"|ezimage}>
{/case}

{/switch}

Regards Bjørn

laurent le cadet

Friday 29 August 2003 5:26:02 am

Bjørn,

Actually this is a static image.
In your example I understand that is not really dynamic, because you have to know per advance the ID of the node. It's ok for me but at the end I want the company I work for to do everythings by itself.

I'm not really sure but I think it's better to fetch images the same way than info pages (from db).

Am I right ?

Bjørn Kaarstein

Monday 01 September 2003 1:28:59 am

Hi.

No computing for me this weekend :)

My example wasn't very dynamic, so what I think you ought to do is the following.

Add one (or more) image field(s) to your article class, and fetch it out something like this:

{section show=ne($node.data_map.photo.content, 0)}
<img src={$node.data_map.photo.content[medium].full_path|ezroot} />
{/section}

This will display the image if it's added with the article. This will make it easy for your users to change these pictures themselves in the future.

Good luck!

Regards Bjørn.

laurent le cadet

Monday 01 September 2003 2:32:14 am

Hi Bjørn,

Was the WE ok ;-) ?

It works very well.
Just another question (maybe the last one), it don't seems to be possible to set the image size to "original" instead of medium.
No way ?

Thanks for working on my case.

Laurent

laurent le cadet

Monday 01 September 2003 2:54:46 am

There is a cache problem.
If I stay in the same section, it keeps on working well (most of the time !?!)
But if I change (a different page layout) and go back to the previous section, images don't appear anymore till I clean the content view cache :-(
Strange or normal ?

Bjørn Kaarstein

Monday 01 September 2003 3:42:50 am

Hi Laurent.

The weekend was very OK :)

<img src={$node.data_map.photo.content[original].full_path|ezroot} /> is working fine for me. If you can't get it to work, you can edit the ImageSettings in site.ini to adapt to your design.

I'm not quite sure on your cache problems, (Sounds strange, though...) but you could try to set viewcaching=disabled in site.ini.

Regards Bjørn

laurent le cadet

Monday 01 September 2003 5:45:27 am

Yes yes yes !

The problem with the [original] size was due to the cacheviewing setting.
I turned the cache off and now the size is ok and everything works fine.

Thanks.

Hope to meet you again ;-)

Laurent.

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