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

eZ debug

Timing: Jan 31 2025 07:19:25
Script start
Timing: Jan 31 2025 07:19:25
Module start 'content'
Timing: Jan 31 2025 07:19:25
Module end 'content'
Timing: Jan 31 2025 07:19:25
Script end

Main resources:

Total runtime0.1161 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.1875180.7969
Module start 'content' 0.00530.0056 768.9844102.1016
Module end 'content' 0.01090.1051 871.0859533.4219
Script end 0.1160  1,404.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00282.4124200.0001
Check MTime0.00110.9738200.0001
Mysql Total
Database connection0.00060.542810.0006
Mysqli_queries0.076866.14371410.0005
Looping result0.00090.74221390.0000
Template Total0.104890.310.1048
Template load0.00070.597010.0007
Template processing0.104189.705010.1041
Override
Cache load0.00040.362710.0004
Sytem overhead
Fetch class attribute can translate value0.00050.442810.0005
XML
Image XML parsing0.00020.211110.0002
General
dbfile0.00776.6446200.0004
String conversion0.00000.003330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs