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.