Hello (it’s me again),
how do I use (implement?) php scypts to my pages? I’d like to add simple script (to blog item) that reads directory and displays it’s content as links. Do I need a extension for it? Or I can just use <?php ?> in .md file?
Hello (it’s me again),
how do I use (implement?) php scypts to my pages? I’d like to add simple script (to blog item) that reads directory and displays it’s content as links. Do I need a extension for it? Or I can just use <?php ?> in .md file?
You can’t put PHP in markdown files, that’s simply not allowed. You can put Twig in markdown however to perform ‘logic’.
If you REALLY wanted PHP in Twig, you could install a Twig extension that provided that capability but its really frowned upon. and not something I would advise at all.
What I rly want, is directory content as links, not necessarily via .PHP
I assume I need to add them manually in Markdown.
You might be better off creating a Grav plugin that loads the directory and stores the results as a variable in the Twig environment. Then you can simply loop over the results in that variable in the Twig template, or even the markdown page if you put the Twig in there.
You can put Twig in markdown however to perform ‘logic’.
How can I do that? I have some data intwig_vars
and I’d like to present them in .md file
ok I have solution, just put this at the beginning of .md file:
title: Some Title
...
process:
twig: true
and then the usual {{ whatever }}