Forum

Thread tagged as: Question, Problem

Perch page combine with layout

Hello,

This is my default page

<?php include('perch/runtime.php'); ?>
<?php perch_layout('global.header'); ?>
<?php perch_content('Content'); ?>
<?php
    perch_layout('global.footer', array(
        'newsletter_section'=>true,
    ));
?>

In perch page attributes i have following code

<perch:pages id="newsletter_show" label="Newsletter" type="checkbox" value="true" divider-before="Settings" help="Add newsletter section above footer" suppress="true" />

And in my global.footer have

if (perch_layout_var("newsletter_section",perch_page_attribute('newsletter_show', array('template' => 'newsletter.html','skip-template' => true,'return-html'   => false), true))){
        perch_content('Newsletter');
    }

If checkbox is true, content is showing. but when its false in output have text "1" and content is not displayed.

Pavol Krchnavy

Pavol Krchnavy 0 points

  • 5 years ago

SOLVED:

$newsletter = perch_page_attribute('newsletter_show', array('template' => 'newsletter.html','skip-template' => true,'return-html'   => false), true);


    if($newsletter){
        perch_content('Newsletter');
    }


Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great.