2017 © Pedro Peláez
 

phile-plugin render

Render the content of a page by passing it's URL.

image

phile/render

Render the content of a page by passing it's URL.

  • Thursday, June 19, 2014
  • by NeoBlack
  • Repository
  • 2 Watchers
  • 1 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

phileRender

Render the content of a page by passing it's URL., (*1)

This plugin requires that you use Twig for your template engine, (*2)

1.1 Installation (composer)

php composer.phar require phile/render:*

1.2 Installation (Download)

  • Install Phile
  • Clone this repo into plugins/phile/render

2. Activation

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);

Usage

There will now be a new twig function called render. It takes a URL to a page, and renders the HTML for it!, (*4)

Basic Examples:

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)

Conditional Examples

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)

Errors

This plugin will fail silently if no page is found, or the conditional is not met., (*12)

The Versions

19/06 2014

dev-master

9999999-dev http://philecms.com

Render the content of a page by passing it's URL.

  Sources   Download

MIT

The Requires

 

cms content phile