Herez what I did, I created a custom block and set "get from file" as myscript.php Then created an article and editied its list layout to add this custom block there and when I viewed it through articles.php?category_id=[my category id] It showed up blank, the header and footer where fine but the page body didnt show up. Additionally to test whether am doing it right, I added some html to the myscript.php file and the html showed up fine.
The select box or what ever html I have shows up but the php does not.
wavi (Guest)
28 Jun 2007 11:02 AM
Have you activate php alowed ?
System >Global setting
and select the option you want:
Allow to run PHP code in
Greetings / Introduction Footer body Custom Blocks Custom Pages
donna
27 Aug 2007 8:16 PM
I want to do this as well(run php in a custom block), but I don't have any option in the System/Global Settings that refers to running php code in custom blocks. I am on version 3.1
wavi (Guest)
28 Aug 2007 8:06 AM
danmorph,
this options running from 3.2 release (for use this required update).
Option to run PHP code in the blocks
From version 3.2 you have the possibility to add php code directly to some blocks, like: Footer body, Custom block, Custom Pages, Greetings/Introduction. To activate this option for these blocks, please go to Administration > System > Global Settings and tick off the appropriate checkboxes in the ‘Allow to run PHP code in’ fields. When this is done you can try to enter any php code for mentioned blocks.
tellraj (Guest)
7 Sep 2007 12:01 PM
i created a custom block and a file that have php code for multilevel categories menu using <ul> and <li> but it display the categories top of the page not particular block. plz help me.
Vito
12 Sep 2007 9:04 PM
Hello,
If you want to add some HTML code directly to your block please use $block_body variable, like in the example below:
<?php
$block_body .= "My HTML Code";
?>
Thanks,
ViArt Support Team
wecreateyou
26 Sep 2007 8:14 PM
I really don't understand what is meant by use the $block_body variable.
Please explain what to do or where to place the code..
AmandaK (Guest)
26 Sep 2007 8:27 PM
A more detailed tutorial on this is needed. This may help solve my search issue as well.
wecreateyou
26 Sep 2007 9:31 PM
I think I get it. I'm posting this to help others and possibly get more help myself. if I'm wrong I'm sorry but some input seems better than none at all.
If you're running 3.2 ONLY!
Step 1. Turn on php in custom blocks ( in global settings)
Step 2. Your php code needs to be an existing php document, such as "myscript.php" This php file (myscript.php) should look like this
<?php
$block_body .= "My HTML Code";
?>
Where "My HTML Code" is the code you want to display in the block,
Like this:
<?php
$block_body .= "
<select>
<option>bla bla</option>
</select>
";
?>
Step 3. Create a custom block and set "get from file" as myscript.php
I hope this helps. please post any more info you may have on this feature that might help the community.