Im new to October CMS I read the documentation and its states that components can be used inside a layout on the PHP Section (https://octobercms.com/docs/cms/layouts)
i want to create a component that will be used as configuration file for my theme, declaring global variables, that will be used on all pages, but will also be used for all layouts i will create. but i cant find how to do it via code. Like include a file. i want this to used this parameters inside the PHP Section of the layout and the pages.
If components is not the best way, can you ppl sugest me what is the best way
I did before search a lot to find some way that I can share variables to all my layouts and pages but couldn't find anything.
So I tried my own trick and it worked.
In your frontend you must have
header.htm
partial. so in the code section in it write aonStart()
function and set your global variables so you can access them from any layout or page which includes theheader
partial.For example in your
header.htm
code section:That way you can access
my_var
variable wherever you want in all your layouts and pages whichheader.htm
partial is included.