Forum

Thread tagged as: Question, Problem

perch_content_create ?

Hi,

I have a master pager that uses perch_content_create. My question is when a new page is created from the master page, does the new page have to be loaded in the browser in order for the perch_content_create function to run and the region created?

That is how it is working for me. Is there a way for the region to be created from the master page at the same time the page is created? That way a user does not have to go back and load the page in order for the region to show up.

My master page...

<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); 
    perch_layout('global.header');
?> 

<?php 

perch_content_create('Page Content', array(
    'template' => 'new_page.html',
    'multiple' => false,
    'edit-mode' => 'singlepage',
)); 

?>


<?php perch_layout('global.footer'); ?> 
Shawn North

Shawn North 0 points

  • 5 years ago

Never mind. Looks like the issue was my perch_content_create needed to be before any other function.

So this fixed it and allowed the region to be created without having to first load the new page.

<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); 

    perch_content_create('Page Content', array(
        'template' => 'blocks.html',
        'multiple' => false,
        'edit-mode' => 'singlepage',
        )); 

    perch_layout('global.header');
?> 


<?php perch_layout('global.footer'); ?> 
Drew McLellan

Drew McLellan 2638 points
Perch Support

Perfect.