Forums / General / How can I output data from an attribute?

How can I output data from an attribute?

Author Message

Steven Stieng

Friday 21 May 2010 4:33:47 am

I'm noob and need some basic 101.

I need to dispaly content from my "home" page. The page has the following  attributes:

  • Name
  • Billboard
  • Left column
  • Center column
  • Right column
  •  Bottom column
  • Tags

Currently I use `{$module_result.content}` which outputs everything on that page.

But I only want to output the content from Billboard and Center column. How can I do this?

Lars Eirik R

Tuesday 25 May 2010 12:27:11 am

In override/full/frontpage.tpl
output the following:
(attribute_view_gui attribute=$node.data_map.bilboard} // this will run the template for the bilboard datatype of yours.
You only use module.result.content to output evertyhing in the framework itself.
This is run after the frontpage.tpl is run.
Make sure you activate debug to view which templates is in use.
- Lars

Steven Stieng

Tuesday 25 May 2010 11:19:28 pm

Thanks for your reply.

Adding that line does nothing.
This is my code so far in pagelayout.tpl:

(Isn't there a code block function some where??)

 

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$site.http_equiv.Content-language|wash}" lang="{$site.http_equiv.Content-language|wash}">
<head>
{def $basket_is_empty = cond( $current_user.is_logged_in, fetch( shop, basket ).is_empty, 1 )
 $user_hash = concat( $current_user.role_id_list|implode( ',' ), ',', $current_user.limited_assignment_value_list|implode( ',' ) )}
{include uri='design:page_head_displaystyles.tpl'}
{if is_set( $extra_cache_key )|not}
 {def $extra_cache_key = ''}
{/if}
{cache-block keys=array( $module_result.uri, $basket_is_empty, $current_user.contentobject_id, $extra_cache_key )}
{def $pagedata = ezpagedata()
 $pagestyle = $pagedata.css_classes
 $locales = fetch( 'content', 'translation_list' )
 $pagedesign = $pagedata.template_look
 $current_node_id = $pagedata.node_id}
{include uri='design:page_head.tpl'}
{include uri='design:page_head_style.tpl'}
{include uri='design:page_head_script.tpl'}
</head>
 <body>
 <!-- Complete page area: START -->
 
 <!-- Change between "sidemenu"/"nosidemenu" and "extrainfo"/"noextrainfo" to switch display of side columns on or off -->
 
 <div id="outerWrapper">
 
 <!-- Top section -->
 <div id="headerSection">
 <div class="innerWrapper">
 {include uri='design:page_header_logo.tpl'}
 
 <!-- Top menu area: START -->
 {if $pagedata.top_menu}
 {include uri='design:page_topmenu.tpl'}
 {/if}
 
 </div>
 </div>
 
 <!-- Main section -->
 <div id="mainSection">
 <div class="innerWrapper">
 
 {attribute_view_gui attribute=$node.data_map.bilboard}
 
 <span class="divider"></span>
 </div>
 </div>
 
 <!-- Bottom section -->
 <div id="footerSection">
 </div>
 
 </div>
 
 {/cache-block}
 
 {* This comment will be replaced with actual debug report (if debug is on). *}
 <!--DEBUG_REPORT-->
 </body>
</html>

 

Lars Eirik R

Wednesday 26 May 2010 12:10:40 am

Looks like you are working on the wrong template:

The code you display here is from the pagelayout.

This is actually rendered after the particular content area, therefore you need to consider pagelayout your framework,whereas everything underneath override/templates is meant to be a template for each of your content classes.

In your case the frontpage.tpl is where you should add momentum.

in frontpage.tpl you should be able to do do as i suggested above.

The attribute_view_gui function is not available in the framework.

The framework basically makes sure that everythinng which is chucked together in the contentarea may be places correctly within the framework, so you can include a top navi, left nav, footer and similar.

Also this enables you to activate caching basied on who is logged in.

Steven Stieng

Friday 28 May 2010 9:39:37 am

ok ,thanks.

eZ debug

Timing: Jan 18 2025 15:04:54
Script start
Timing: Jan 18 2025 15:04:54
Module start 'content'
Timing: Jan 18 2025 15:04:55
Module end 'content'
Timing: Jan 18 2025 15:04:55
Script end

Main resources:

Total runtime0.7278 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 587.7266180.8359
Module start 'content' 0.00510.6043 768.5625545.7109
Module end 'content' 0.60940.1183 1,314.2734337.3906
Script end 0.7277  1,651.6641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.5613210.0002
Check MTime0.00150.2000210.0001
Mysql Total
Database connection0.00060.076810.0006
Mysqli_queries0.641688.15512000.0032
Looping result0.00180.24641980.0000
Template Total0.704896.920.3524
Template load0.00200.271020.0010
Template processing0.702996.578620.3514
Template load and register function0.00010.015010.0001
states
state_id_array0.00060.084010.0006
state_identifier_array0.00090.119320.0004
Override
Cache load0.00190.26311040.0000
Sytem overhead
Fetch class attribute can translate value0.00090.123330.0003
Fetch class attribute name0.00110.155360.0002
XML
Image XML parsing0.00230.316430.0008
class_abstraction
Instantiating content class attribute0.00000.002470.0000
General
dbfile0.00550.7553270.0002
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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs