Page 1 of 1

Static Page Usage

Posted: Thu Jul 21, 2022 1:50 pm
by WineMan
I have gone through the Wiki and can't seem to find the answer to my question which is...can php be used in static pages and if so how. I tried it with the code tag but all that does is show the php code. Thanks in advance.

Re: Static Page Usage

Posted: Wed Jul 27, 2022 12:25 pm
by Arvid
Hi,

the code tag is indeed not for executing code, just for displaying it.

Take a look at the Inline PHP plugin - but make sure to read and understand the red warning box carefully.
The better (although more complex) way is always to embed your custom PHP code into a dedicated FlatPress plugin and/or custom BBCode tags.

All the best,
Arvid

Re: Static Page Usage

Posted: Wed Jul 27, 2022 7:04 pm
by WineMan
Thank you Arvid...perhaps it will be better to generate my own plugin once I find out how to make my own plugin. Baby steps...

Re: Static Page Usage

Posted: Thu Jul 28, 2022 12:09 pm
by Arvid
Don't worry, it's no rocket science, not at all :)

Start with the custom BBCode example, it's basically all you need to have a) your first own plugin that comes b) with your first own BBCode tag.
In the plugin_custombbcode_acronym() callback function that is called whenever a "acronym" tag is being parsed, you can return anything you like - for example, the output of the PHP code you wish to include.
If that works out, change the tag name from "acronym" to something more fitting, and play around with the other options in plugin_custombbcode_tags(). This is exactly how I started coding for FlatPress back in the days :)

All the best,
Arvid