Forums / Setup & design / How to buffer $module_result.content to show previous result

How to buffer $module_result.content to show previous result

Author Message

Neven Susa

Wednesday 25 April 2007 11:35:52 pm

Full title:
How to <b>buffer</b> $module_result.content to show <b>previous result when node is empty?</b>

My problem is to have left menu with (some of, not all !! ) main categories not having any content,
so when they are clicked the empty center of the page shows.
Subcategories are the ones which have content to show.
($module_result.content is called ONLY)

-main1 (full)
--sub11 (full)
--sub12 (full)
-main2 (empty)
--sub21 (full)
--sub22 (full)
-main3 (empty)
--sub31 (full)
--sub32 (full)

I want to do something like:
When I click one of the empty main categories, at the center of the page remains content of the previous full e.g. subcategory.
Also, when several empty nodes are clicked in a row it still must show last node that is not empty.

e.g. I click sub11-> main2 STILL SHOWS sub11
sub12-> main2 -> main3 STILL SHOWS sub12
main1-> main2 STILL SHOWS main1

don't think it requires overriding pagelayout.tpl because i need to show any <i>previous result that is not empty</i>, and not <i>differrent result</i> depending on the node selected.

I tried to buffer $module_result.content in a variable but it doesn't work.
(when displayed attributes with attribute operator,
it shows that .content is of type string )

didn't find similar question/solution in forum, so,
if there is somebody that knows how to solve this, i would be grateful.

André R.

Thursday 26 April 2007 12:33:29 am

You could use the session extension to save the content pr user.
BUT, this is IMO insane, first of it will drag your server down if you get a lot of users, secondly you should rather solve empty page with some specialized template that give a small intro to each sub element. Kind of like 'Summery pages'.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Xavier Dutoit

Friday 27 April 2007 9:10:21 am

I really don't see the point of what you're trying to do.

Looks like you're looking at the wrong solution for your problem.

On the left menu, if the page is empty, instead of putting the url of the page, just put #

X+

http://www.sydesy.com

Betsy Gamrat

Friday 27 April 2007 10:07:27 pm

I would suppress the display of empty content - or just show the name, without a link.

{if $node.data_map.text.has_content)}
  <a href={$node.url_alias|ezurl}>{$node.name}</a>
{else}
  {$node.name}
{/if}

Neven Susa

Monday 30 April 2007 4:12:11 am

Thanks guys for logical solution, now i realize the problem is different than i displayed.

But, here is one thing i forgot to mention, it could be significant:
menu is dynamicaly expanded so the href=#
isn't working because now main category cannot expand it's subcategories at all.
template to create menu is similar to default
\ezpublish\design\base\templates\menu\flat_left.tpl created with treemenu function.

The useful link of what i'm trying to accomplish:
http://www.dhtmlgoodies.com/scripts/slidedown-menu2/slidedown-menu2.html#

Betsy Gamrat

Monday 30 April 2007 9:29:35 pm

Neven,

Do a view source of the page you want to mimic and fill in the blanks with eZ template code.

You'll need a few loops, and the code may be a bit intimidating - but you can do it with eZ.

<a href="#">{$v.name|wash}</a>
<ul>
                {foreach fetch('content','list',hash('parent_node_id',$v.node_id)) as $kk=>$vv}
	<li><a href={$vv.url_alias|ezurl}>{$vv.name|wash}</a></li>
                {/foreach}
</ul>

In this case - $v is the parent node, and then there is a loop that goes through the children. You would have to nest the loops a bit. I recommend using <b>treemenu</b>.

Good luck