Forum
Header layout value from master pages
Hello,
I am creating a website which consists of three parts:
mydomain.test/led-verlichting/
mydomain.test/infraroodverwarming/
All pages and subpages are created from masterpages, because the pages are the same but the content is different. I have created css files to change color, so all three pages have to have different css files:
mydomain.test/zonnepanelen/ - green.css
mydomain.test/led-verlichting/ - blue.css
mydomain.test/infraroodverwarming/ - yellow.css
I have one header layout for all pages.
Now in my header.php layout I have tried the following conditional:
<?php
if (perch_layout_has('green')) {
echo '<link href="/css/green.css" rel="stylesheet">';
} else if (perch_layout_has('blue')) {
echo '<link href="/css/blue.css" rel="stylesheet">';
} else {
echo '<link href="/css/yellow.css" rel="stylesheet">';
}
?>
and in my masterpage:
<?php
perch_layout('header', array(
"blue" => true
));
?>
So, how can I pass the layout value to those pages when they are all coming from the same master page? I hope this explanation makes sense.
Mike
I would use page attributes for that.
https://docs.grabaperch.com/video/v/page-attributes/
Great solution! It is working now, thank you Drew.