This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
JimRed
Hello Sirs,
Can you help me please? How can I set a variable in PHP section on page and then use that variable in PHP section of Layout?
Thank you for your help!
daftspunky
Example page (mypage.htm):
title = "Example page"
url = "/mypage"
layout = "default"
==
function onStart()
{
$this['foo'] = 'bar';
}
==
... Page contents ...
Example layout (default.htm):
description = "Default layout"
==
function onEnd()
{
echo "I have access to " . $this['foo'] . " here";
}
==
The variable from the page is {{ foo }}
... Layout contents ...
Further reading: http://octobercms.com/docs/cms/layouts#dynamic-layouts
Last updated
JimRed
Oh my god. As easy as pie. Sorry, I feel so stupid now. :) Thank you very much for the detailed description.
1-3 of 3