0

I am using a page--front.tpl for my frontpage.

It overrides a panelpage whice i use for my frontpage.

I can display the content of my panelpage with <?php print $content; ?>

Is it possible to specify which region of my panelpage i can print with php?

2
  • I'm to curious not to ask, why would you be overriding a panel page, with a template?
    – Letharion
    Oct 23, 2014 at 16:43
  • Im using it to display different widths on my page. For instance one banner width 100%, using custom css for this. The second section, width 70%. Here using the adaptive theme interface to specify the width. Without an override the interface can only be used for the whole page.Overriding the template file makes it able to mix panel sections using the template width and sections usin custom css.
    – Byron
    Oct 26, 2014 at 19:42

1 Answer 1

0

Yes, $page['content'] is an associative array. You can pick, which parts of the array you'd like to display. However, I think calling print directly is not the right way. Call the render() function instead:

<?php print render($page['content']['your_section']); ?>
7
  • Thanks How exactly do i get 'my_section'? I am figuring out with my themer info however cannot put my finger on a 'section'/panelpane to render
    – Byron
    Oct 23, 2014 at 18:17
  • The content of ['content'] depends on your setup - mostly the modules you are using. To get a full list, you can loop through the array and print the content of each field with a dsm (drupal_set_message()). Oct 23, 2014 at 22:21
  • as in foreach ($page['content'] as $key => $value) { drupal_set_message('content key ' . $key . ' is ' . $value); } This should give you a full list. Oct 23, 2014 at 22:23
  • Oops - formatting above got a little messed up when I posted. But I suspect you'll see where to split the lines. Oct 23, 2014 at 22:23
  • Tried: <?php ($page['content'] as $key => $value) { drupal_set_message('content key ' . $key . ' is ' . $value); } ?> Due to my limited php skills my attempts doing a dsm resulted in fatal errors (Hoped to be able to use theme developer instead)
    – Byron
    Oct 24, 2014 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.