Forums / Setup & design / tabbed block

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?

eZ debug

Timing: Jan 17 2025 21:58:58
Script start
Timing: Jan 17 2025 21:58:58
Module start 'content'
Timing: Jan 17 2025 21:58:59
Module end 'content'
Timing: Jan 17 2025 21:58:59
Script end

Main resources:

Total runtime1.0094 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 587.5859180.8594
Module start 'content' 0.00710.8974 768.4453620.4297
Module end 'content' 0.90440.1048 1,388.8750341.3906
Script end 1.0093  1,730.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4005210.0002
Check MTime0.00150.1480210.0001
Mysql Total
Database connection0.00070.073010.0007
Mysqli_queries0.944193.53682060.0046
Looping result0.00170.16352040.0000
Template Total0.974896.620.4874
Template load0.00210.206820.0010
Template processing0.972796.369820.4864
Template load and register function0.00020.018310.0002
states
state_id_array0.00070.071910.0007
state_identifier_array0.00060.059620.0003
Override
Cache load0.00180.1742230.0001
Sytem overhead
Fetch class attribute can translate value0.00080.076940.0002
Fetch class attribute name0.00110.104970.0002
XML
Image XML parsing0.00100.097940.0002
class_abstraction
Instantiating content class attribute0.00000.001270.0000
General
dbfile0.00310.3106260.0001
String conversion0.00000.000830.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
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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs