Jump to content

Issue rendering child pages


MikeB
 Share

Recommended Posts

I am having issues rendering child pages. I am trying to create an easy means of structuring pages for use with bootstrap 3. Adding field selectors for some common css constructs such as pad and column count and additional css classes. Then I am adding in common bootstrap 3 constructs as reusable templates. When things are simple I use a ckeditor body field to out put the final content. But for something more complex at the end I use Ace text editor body field.

An example

Section - template

-- Container - template

----Row - template

------Column - template

--------Sub Column - template with Ace Body text

My issue is that after the first Ace Body text is rendered, that same body text is appearing everywhere I render page children.

Please see attached image for issue markup.

post-2113-0-36713100-1399901441_thumb.pn

I have also included a subset of my template files for reference below

/**
 * Column template
 */

<div class="row <?php if($page->pad_select!=none) echo 'pad' . $page->pad_select; ?> <?php if($page->additional_css_classes) echo $page->additional_css_classes; ?>">
  <?php
  foreach($page->children as $child)
    echo $child->render();
  ?>
</div>
/*
 * Row template
 */

<div class="row <?php if($page->pad_select!=none) echo 'pad' . $page->pad_select; ?> <?php if($page->additional_css_classes) echo $page->additional_css_classes; ?>">
  <?php
  foreach($page->children as $child)
    echo $child->render();
  ?>
</div>
/*
 * Sub column template (The one causing the issue - I think)
 */

<div class="<?php if ($page->col_select_sm!=none) echo 'col-sm-' . $page->col_select_sm; ?> <?php if ($page->col_select_md!=none) echo 'col-md-' . $page->col_select_md; ?> <?php if ($page->col_select_lg!=none) echo 'col-lg-' . $page->col_select_lg; ?> <?php if($page->pad_select!=none) echo 'pad' . $page->pad_select; ?> <?php if($page->additional_css_classes) echo $page->additional_css_classes; ?>">
  <?php echo $page->body; ?>
  <?php echo $page->ace_body; ?>
</div>

Any ideas why the first ace_body is now getting repeated all over my page.

By the way, this is for a single page layout. It may not be the best way to go about it. I am just experimenting for now as I learn.

Link to comment
Share on other sites

I'm missing some information to be able to help you further. Can you show all the code of the entire template from section, container, row, column, sub column.

I have used a similar setup for a website once, so i might be able to help you a little further when i have some better idea of the complete code.

I'm guesing that you are using somekind of page structure like this, am i right?

post-694-0-85095700-1382003410_thumb.png
Link to comment
Share on other sites

Yes exactly right. And I have solved my own problem, but thanks for getting back to me. Just noticed that the Ace Body field that was getting repeated had been incorrectly entered. the anchor tag was not closed, causing it to bleed everywhere.

Closed the tag and now all works as expected. My bad.

But thanks once again for getting back to me.

I hope I can continue to optimize this further, but for now it is nice and easy to drop in sections/columns and everything as and where I want. Lots of re-use.


By the way, i like your use of "row header" and "row content" I will make use of that in my optimization.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...