Mecha CMS

Add extra functionality to the core engine.

PHP Page

Table of Contents
  1. Usage 

Evaluate PHP syntax within the page content.

Download Stable Version Download Development Version

Something looks broken? We accept bounties to fix them faster.

^24 Downloads
v1.0.349 Downloads
v1.0.225 Downloads
v1.0.024 Downloads

This extension is not to be used on a site with multiple users. Other users may use this feature to execute malicious functions to break your system.

If you don’t like the block evaluation method, you can use this extension to evaluate PHP expressions in the page file. It’s just that, you need to write the page content as raw HTML code, so you can’t combine this extension feature with markdown extension and the like (unless you are fine with implementing the parser in the PHP code).

Usage 

In your page header, add type property with value set to PHP or application/php:

---
title: Page Title
description: Page description.
author: Taufik Nurrohman
type: PHP
...

<p>This is a <strong>bold</strong> text.</p>
<p>Today is <?= $date->en; ?>.</p>
<?php

// Declare some PHP expressions here…

echo 'Yo!';

?>
<p>Other HTML code goes here.</p>

This extension is suitable to be combined with route extension.