Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How could I insert custom php code on the page?

Started by Muut Archive 11 years ago · 1 replies · 1530 views
11 years ago

I need to insert some php code on the page. Twig is not enough to do this.
Is is real to do this?

11 years ago

Inserting custom PHP code in output is a fundamental security risk. Most CMS system's do not allow this for this very reason.

If you need to have custom PHP for some reason, Grav's simple plugin system makes this very easy. You can do PHP 'work' then set the result as a Twig variable that can be output in a Twig template. Or you can create a Twig filter or function to let you do it dynamically. Or you maybe able to just use Twig's existing functions to recreate the PHP in Twig syntax.

There's really nothing that can't be done with Grav, you just can't drop in PHP directly into the output.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1330 9 years ago
Archive · by Muut Archive, 9 years ago
2 922 9 years ago
Archive · by Muut Archive, 9 years ago
2 4052 9 years ago
Archive · by Muut Archive, 9 years ago
1 2930 9 years ago
Archive · by Muut Archive, 9 years ago
3 1109 9 years ago