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

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

eZ debug

Timing: Jan 19 2025 03:27:57
Script start
Timing: Jan 19 2025 03:27:57
Module start 'layout'
Timing: Jan 19 2025 03:27:57
Module start 'content'
Timing: Jan 19 2025 03:27:58
Module end 'content'
Timing: Jan 19 2025 03:27:58
Script end

Main resources:

Total runtime0.7394 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 589.4141152.6563
Module start 'layout' 0.00450.0028 742.070339.5078
Module start 'content' 0.00730.7308 781.5781669.5703
Module end 'content' 0.73810.0013 1,451.148416.0938
Script end 0.7394  1,467.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00280.3796160.0002
Check MTime0.00120.1612160.0001
Mysql Total
Database connection0.00050.062610.0005
Mysqli_queries0.675591.3622700.0097
Looping result0.00060.0809680.0000
Template Total0.710996.120.3554
Template load0.00180.244120.0009
Template processing0.709195.897620.3545
Template load and register function0.00020.023010.0002
states
state_id_array0.00080.112910.0008
state_identifier_array0.00070.093620.0003
Override
Cache load0.00170.2233610.0000
Sytem overhead
Fetch class attribute can translate value0.00050.069740.0001
Fetch class attribute name0.00090.124890.0001
XML
Image XML parsing0.00160.219540.0004
class_abstraction
Instantiating content class attribute0.00000.0023100.0000
General
dbfile0.00100.1369290.0000
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.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/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 39
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs