Skip to content

Can I access my own key-value pairs in layout files? #1016

Discussion options

You must be logged in to vote

Hello Hendrik. The API for developers gives you access to the file system and settings. Yes, it's possible to store arbitrary key-value pairs in the page settings and access them with page->get(), page->getHtml() and more methods. We are using the same API everywhere from extensions to layout files. This is one of the core features, quite powerful and worth learning sooner or later.

Here's an example layout file system/layouts/default.html:

<?php $this->yellow->layout("header") ?>
<div class="content">
<div class="main" role="main">
<h1><?php echo $this->yellow->page->getHtml("titleContent") ?></h1>
<?php echo $this->yellow->page->getContentHtml() ?>
<?php if ($this->yellow->page->get("in…

Replies: 0 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@henryVr7
Comment options

@markseuffert
Comment options

Answer selected by henryVr7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants