small Question, I have a variable defined in my Snippet header.php, let’s say $sidebar = 1, now I want also to use this variable in my snippet footer.php. But a error appears that the variable is not defined. Any workaround for this?
Thanks for your answers … @texnixe, I have a global Blueprint setting which I load in all blueprints for “activate sidebar”, problem is that in header.php, there’s a switch for Bootstrap class COL-SM-9 or COL-SM-12 and in footer.php there’s the rest, if {activate sidebar == 1} { ... } else { ... } and in some other case I need this also in the menu.php Snippet.
Not sure why this doens’t work, the two workarounds seems not to be the best solutions. In my first tryouts with Kirby I have created a variables.php which seems to be the best solution, but I can’t get access to them (loaded before all other snippets). Would be a great feature, in most CMS this works.
Maybe there’s a little workaround expect of a Plugin or global setting. It’s must change depend of the blueprint settings.
Thanks! Yes it’s possible, but of course very intense to work with. I need this function very often in the Template, and so in this case I have to define it in all snippets. But it will work, yes
Didn’t you say you only need this in max three snippets, header, footer and maybe menu? You could of course create a function, but what do you want the function to return, a class? All possible…