Forum
Force regions
Hi guys, this may be a stupid question - especially considering I've been using Perch for years :) but I can't seem to find the answer anywhere.
For Runway and Perch, can you define what template a region must use - in other words force it so that when a user adds a page they automatically get a configured page with all the regions locked to the correct templates?
Thanks,
Ed
Use the perch_content_create() function:
https://docs.grabaperch.com/functions/content/perch-content-create/
Thanks for the reply Duncan. I've tried the suggestion and I must be doing something wrong.
I added the following to the layout php for a page:
<?php perch_content_create('Horizontal buttons', array('template' => 'horiz_buttons.html')); ?>
But in the Perch editor it still asks for me to choose the template for the region and just shows it's type as 'NEW'.
Thanks,
Ed
You need to make sure you call
perch_content_create()
before the region is used in a page.Ed, normally I place all perch_content_create() calls at the very top of the page right after the call to perch runtime. Hope this helps.
Thanks all.