dev-master
9999999-dev http://philecms.comRender the content of a page by passing it's URL.
MIT
The Requires
by James Doyle
cms content phile
Render the content of a page by passing it's URL.
Render the content of a page by passing it's URL., (*1)
This plugin requires that you use Twig for your template engine, (*2)
php composer.phar require phile/render:*
plugins/phile/render
After you have installed the plugin. You need to add the following line to your config.php
file:, (*3)
$config['plugins']['phile\\render'] = array('active' => true);
There will now be a new twig function called render
. It takes a URL to a page, and renders the HTML for it!, (*4)
The path is the same as the way we load pages via URLs., (*5)
Let's say we have a page at content/special.md
, then we will use:, (*6)
{{ render('special') }}
This will render the HTML of the special
page., (*7)
Let's say we have a page at content/sub/special-nested.md
, then we will use:, (*8)
{{ render('sub/special-nested') }}
This will render the HTML of the sub/special-nested
page., (*9)
In the config file you can set conditionals so you don't load a page that may not be setup for loading in this way., (*10)
return array( 'conditional_checks' => array( 'template' => 'partial', 'role' => 'custom' ) );
This conditional means: only load pages that have a template of 'partial' and a role that is 'custom'. We can use any custom meta for the conditionals. We can also use multiple key => values for checking as you can see from the example., (*11)
This plugin will fail silently if no page is found, or the conditional is not met., (*12)
Render the content of a page by passing it's URL.
MIT
cms content phile