Jump to content

Regions on basic page


psy
 Share

Recommended Posts

I am using regions with the tag <region id="whatever"> in the _main.php file. Config file is set up as follows:

$config->useMarkupRegions = true;
$config->prependTemplateFile = '_init.php';
$config->appendTemplateFile = '_main.php';

When I use a page template that changes a region, all goes well. However, I set up the _main.php file to reflect the output for a basic page. The basic-page.php template needed no customisation so was simply as follows:

<?php namespace ProcessWire;
?>

When a page with the basic-page template was output, all the <region> tags remained in the HTML, ie were not stripped.

When I added a customised region to the basic-page.php template, all the <region> tags were stripped from the output _main.php HTML.

Did I do something wrong or is this a bug?

Using ProcessWire 3.0.63 © 2017 

 

Link to comment
Share on other sites

Quick workaround... in _main.php add

<region id="dummy"></region>

in basic-page.php add

<region id="dummy"></region>

Seems PW needs a region in the page template to kick-start the process.

  • Like 3
Link to comment
Share on other sites

  • 4 weeks later...

is there still a bug? Same problem here on Processwire 3.0.69


$config->useMarkupRegions = true;
$config->prependTemplateFile = '_main.php';

in _main.php
 

<?php namespace ProcessWire; include_once("./_init.php"); ?>

....

<region id="dummy">
  <h1><?php echo $title; ?></h1>
  <?php echo $teaser; echo $content; ?>
</region>


in basic-page.php

<?php namespace ProcessWire; ?>

<p pw-prepend="dummy">
  123
</p>

 

Voila:

Unbenannt33333333.PNG.fb02cf29cca6dafd8eb0865dee9dd213.PNG

  • Like 1
Link to comment
Share on other sites

@maxf5 Did you try it with <pw-region> too? Sure, they should be the same, but still...

To tell the truth, I never really understood why having all these variations of the same thing is good. It just makes things more confusing, more time to debug but adds no additional feature. It's like having similarly named methods doing the same thing. Well, at least they are supposed to do the same ;) 

Link to comment
Share on other sites

@szabesz , yes.. some problem with <pw-region>

in _main.php

<pw-region id="something">
...
</pw-region>


in basic-page.php

<p pw-append="something">
  12123123123
</p>

and you get:
Unbenannt33.PNG.26ad4c103b1394b8055261c048ef5f4d.PNG

Settings:
$config->useMarkupRegions = true;
$config->prependTemplateFile = '_main.php';
ProcessWire 3.0.69 

PHP VERSION 7.0.18

 

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

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

×
×
  • Create New...