Sections within templates
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexExplain Please
Author Message
Kendle
500+ Posts Club


Joined: Dec 16, 2004
Posts: 529

PostPost subject: Sections within templates
Posted: Wed Dec 14, 2005 10:26 am
Reply with quote

I'm trying to template a module and have got stuck trying to understand how the templating system uses sections within the template.

Basically I've got a chunk of HTML that displays a row of data from the database. I've figured out how to re-use this chunk for each row, but I also want to incorporate a variable number of columns within the row, so what I tried to do this:-

Code:
<!-- BEGIN section -->
<tr>
  <td>{section.COLUMN_1}</td>
  <td>{section.COLUMN_2}</td>

  <!-- BEGIN section.sub_section -->
  <td>{section.sub_section.COLUMN_X}</td>
  <!-- END section.sub_section -->

</tr>
<!-- END section -->

But that doesn't seem to work. Is it actually possible to nest sections within each other like this?


Kendle's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: Re: Sections within templates
Posted: Wed Dec 14, 2005 11:22 am
Reply with quote

Code:
assign_blocks_vars('section', array());
    assign_blocks_vars('section.sub_section', array());
    assign_blocks_vars('section.sub_section', array());
    assign_blocks_vars('section.sub_section', array());
    assign_blocks_vars('section.sub_section', array());
assign_blocks_vars('section', array());
    assign_blocks_vars('section.sub_section', array());
    assign_blocks_vars('section.sub_section', array());
    assign_blocks_vars('section.sub_section', array());
    assign_blocks_vars('section.sub_section', array());


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger
Kendle
500+ Posts Club


Joined: Dec 16, 2004
Posts: 529

PostPost subject: Re: Sections within templates
Posted: Wed Dec 14, 2005 11:54 am
Reply with quote

Doesn't work. The template works fine without the sub section (albeit not displaying what I want it to), so it must be just that bit that's at fault. Are there any examples of modules with a BEGIN - END block nested within another?
_________________
Gaming League / Cup - www.leaguecms.co.uk :: Other DragonFly modules - www.cmsdreams.co.uk

Kendle's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
Biggles
Debugger


Joined: Aug 03, 2005
Posts: 637
Location: St. Louis, MO

PostPost subject: Re: Sections within templates
Posted: Wed Dec 14, 2005 3:02 pm
Reply with quote

The BEGIN and END statements should not have the parent/section id in them, they should be:
PHP:
<!-- BEGIN section -->
...
<!--
BEGIN subsection -->
...
<!--
END subsection -->
...
<!--
END section -->

It's a little goofy since when assigning subsections to the block you have to have the section name but when displaying you don't. Here's an entire write-up of how the assign_block_vars() method works:
Forums/viewtopic/t=13852.html#91457


Biggles's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Win, Linux/1.3.34/4.0.26, 5.0.19/4.3.10, 5.1.2, 8.1.4(PostgresSQL)/9.0.6.1, CVS
Back to top
View user's profile Visit poster's website ICQ Number AIM Address MSN Messenger Yahoo Messenger
Kendle
500+ Posts Club


Joined: Dec 16, 2004
Posts: 529

PostPost subject: Re: Sections within templates
Posted: Wed Dec 14, 2005 4:22 pm
Reply with quote

Ah ha!! That's got it! Thanks a million Biggles this was beginning to do my head in. You're a hero! Very Happy
_________________
Gaming League / Cup - www.leaguecms.co.uk :: Other DragonFly modules - www.cmsdreams.co.uk

Kendle's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexExplain Please All times are GMT
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

stopsoftwarepatents.eu petition banner
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.8286 seconds with 19 DB Queries in 0.1256 seconds
Memory Usage: 2.9 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy