Mecha CMS

Mecha CMS blog and documentation.

The {{php}} Shortcode

Updated: Sunday, 07 August 2016

Using {{php}} shortcode.

The {{php}} shortcode allows you to insert PHP commands in the post content. Let’s say that {{php}} is <?php and {{/php}} is ?>:

{{php}}
foreach(Get::articles() as $path) {
    echo $path . '<br>';
}
{{/php}}

That’s it. Other than that, just keep in mind about semicolons. It is also advisable to click the Preview tab before deciding to publish the article. If you see some error messages appears, it means that you have some problem about the embedded PHP code.

Donation and Email Subscription