Support ⇒ Explain Please :: Archives ⇒ Sections within templates :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexExplain Please

Archived ⇒ Sections within templates


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:-

<!-- 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?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


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());

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


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

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


The BEGIN and END statements should not have the parent/section id in them, they should be:
<!-- 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

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


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

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

All times are UTC