Run php script in Custom Block Manager (OJS, Native Child Theme)

Hi @NateWr

We are using your child theme ( Thank you for this theme, it`s really nice and usefull for me.

I would like to know if it is possible to run a php script in the Custom Block Manager. I would like to have on my right sidebar a Custom Block with fotos which are randomly displayed. Selected fotos I already uploaded to a specific folder. I used this php skript in a created Custom Block:

<?php // Wählen Sie das Verzeichnis $verz = opendir ('/public/site/images/.....'); // Hier werden die Bilder in einen Array eingelesen $bildarray = array(); // Bilder werden nicht wiederholt while ($file = readdir ($verz)) { if (!is_dir($file)) { array_push($bildarray, $file); } } closedir($verz); // Die Zahl 3 gibt an, wieviele Bilder aus dem Bildordner angezeigt werden sollen. $rand_var = array_rand($bildarray, 3); for($x = 0; $x < count($rand_var); $x++) { echo ""; } ?>

But unfortunatly nothing happens. It es possible?

Hi again,

You can not enter php code that way, it would be a security issue to allow that.

You could create a new custom block plugin. See for example

Unfortunately, there are no detailed instructrions available for plugin development. But basically you just need take a copy of an existing plugin, rename the folder, the filenames and the names also inside the files.

Then you add the basic functionality here:

And then edit the template file which shows the ouput: