tabbed block

Author Message

kirill starikov

Wednesday 30 March 2011 11:19:44 am

hello

i would really like to create tabbed blocks on my pages. just simple blocks with tabbed menu where a click on a tab changes the visible content of the block and makes tab active. with or without page reloading, i don't care. i failed to find a ready solution in google and in project section on this webpage...

in which direction should i go?

any help will be much appreciated.

Theodoros Papageorgiou

Wednesday 30 March 2011 2:24:19 pm

Hi, you need to override the node template. Are you going to use a custom class for the content of your tabbed blocks?

WEBWiZ
Web Development
http://www.webwiz.gr

nicholas king

Thursday 31 March 2011 1:40:33 am

this is a page we have that does exactly what you need

of cource you also need to include the relevant javascript files to achieve the tab effect. Take a look at jquery tabs.

{*departmental resources*}<div class="top-right"> <h2>{$node.name}</h2> {def $contentitems = <span> </span>fetch('content','list',hash('parent_node_id',$node.node_id, <span>        </span> 'sort_by', array( priority, true ), <span>        </span> 'class_filter_type','include', <span>        </span> 'class_filter_array',array('department_content')))} {def $count = 1} {def $count2 = 1} <div id="tabs">  <ul>  {foreach $contentitems as $contentitem}   <li><a href="#fragment-{$count}"><span>{$contentitem.data_map.title.content}</span></a></li>   {set $count = inc($count)}  {/foreach}  </ul>  {foreach $contentitems as $contentitem}  <div id="fragment-{$count2}">   {include uri='design:edit_button.tpl' active_node=$contentitem}    {set $count2 = inc($count2)}   {$contentitem.data_map.content.content.output.output_text}  </div>  {/foreach} </div> </div><div class="top-left"> <h2>Resources</h2> {def $resources= <span> </span>fetch('content','list',hash('parent_node_id',$node.parent_node_id, <span>        </span> 'sort_by', array( priority, true ), <span>        </span> 'class_filter_type','include', <span>        </span> 'class_filter_array',array('department_resources')))} <ul> {foreach $resources as $resource} <li><a href={$resource.url|ezurl}>{$resource.name}</a></li> {/foreach} </ul> <div class="related-info">  <h2>Related Information</h2>  {def $parentnode=fetch( 'content', 'node', hash( 'node_id', $node.parent_node_id ) )}  {def $similar = fetch(ezfind, moreLikeThis,hash('query_type','text',  <span>           </span>  'query',$parentnode.data_map.description.content.output.output_text))}  <ul>  {foreach $similar.SearchResult as $result}  <li><a href={$result.url|ezurl()}>{$result.name}</a> ({$result.object.class_identifier})</li>  {/foreach}  </ul>  {*{$similar.SearchResult.0|attribute(show)}*} </div></div>{*departmental resources*}<div class="top-right"> <h2>{$node.name}</h2> {def $contentitems = <span> </span>fetch('content','list',hash('parent_node_id',$node.node_id, <span>        </span> 'sort_by', array( priority, true ), <span>        </span> 'class_filter_type','include', <span>        </span> 'class_filter_array',array('department_content')))} {def $count = 1} {def $count2 = 1} <div id="tabs">  <ul>  {foreach $contentitems as $contentitem}   <li><a href="#fragment-{$count}"><span>{$contentitem.data_map.title.content}</span></a></li>   {set $count = inc($count)}  {/foreach}  </ul>  {foreach $contentitems as $contentitem}  <div id="fragment-{$count2}">   {include uri='design:edit_button.tpl' active_node=$contentitem}    {set $count2 = inc($count2)}   {$contentitem.data_map.content.content.output.output_text}  </div>  {/foreach} </div> </div><div class="top-left"> <h2>Resources</h2> {def $resources= <span> </span>fetch('content','list',hash('parent_node_id',$node.parent_node_id, <span>        </span> 'sort_by', array( priority, true ), <span>        </span> 'class_filter_type','include', <span>        </span> 'class_filter_array',array('department_resources')))} <ul> {foreach $resources as $resource} <li><a href={$resource.url|ezurl}>{$resource.name}</a></li> {/foreach} </ul> <div class="related-info">  <h2>Related Information</h2>  {def $parentnode=fetch( 'content', 'node', hash( 'node_id', $node.parent_node_id ) )}  {def $similar = fetch(ezfind, moreLikeThis,hash('query_type','text',  <span>           </span>  'query',$parentnode.data_map.description.content.output.output_text))}  <ul>  {foreach $similar.SearchResult as $result}  <li><a href={$result.url|ezurl()}>{$result.name}</a> ({$result.object.class_identifier})</li>  {/foreach}  </ul>  {*{$similar.SearchResult.0|attribute(show)}*} </div></div>

kirill starikov

Thursday 31 March 2011 7:10:09 am

thank you very much for the answers

>>Are you going to use a custom class for the content of your tabbed blocks?

no, i think standard article would fit well to my needs.

nicholas king

Thursday 31 March 2011 8:01:00 am

The other thing about tabbed blocks remember to look at the viewcache ini as you will have to set up a view cache for the fetch otherwise the content will not update as required.

kirill starikov

Tuesday 05 April 2011 6:24:41 am

heh, now comes the weird thing... what if i want one of the tabs to be a link to a separate page?

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 18 2025 01:02:26
Script start
Timing: Jan 18 2025 01:02:26
Module start 'layout'
Timing: Jan 18 2025 01:02:26
Module start 'content'
Timing: Jan 18 2025 01:02:27
Module end 'content'
Timing: Jan 18 2025 01:02:27
Script end

Main resources:

Total runtime1.0954 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 587.7891152.6094
Module start 'layout' 0.00460.0039 740.398439.4219
Module start 'content' 0.00851.0857 779.8203615.3672
Module end 'content' 1.09420.0011 1,395.187516.5078
Script end 1.0953  1,411.6953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2897160.0002
Check MTime0.00130.1156160.0001
Mysql Total
Database connection0.00060.050710.0006
Mysqli_queries1.043595.2674690.0151
Looping result0.00070.0668670.0000
Template Total1.065997.320.5330
Template load0.00210.189620.0010
Template processing1.063897.120820.5319
Template load and register function0.00030.023410.0003
states
state_id_array0.00080.074510.0008
state_identifier_array0.00070.063820.0003
Override
Cache load0.00180.1600230.0001
Sytem overhead
Fetch class attribute can translate value0.00060.057230.0002
Fetch class attribute name0.00130.115770.0002
XML
Image XML parsing0.00070.061630.0002
class_abstraction
Instantiating content class attribute0.00000.001270.0000
General
dbfile0.00130.1147150.0001
String conversion0.00000.000740.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
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/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: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs