Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
Zuhair Naqvi (Guest)
Zuhair Naqvi (Guest)
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.
 
Here is the code for myscript.php
 
<?php
echo "PHP running in custom blocks!";
var_dump($_SERVER);
?>
<select>
<option>bla bla</option>
</select>
 
The select box or what ever html I have shows up but the php does not.
 
wavi (Guest)
wavi (Guest)
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
donna
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)
wavi (Guest)
danmorph,
 
this options running from 3.2 release (for use this required update).
 
from
http://www.viart.com/viart_shop_v_dot_3_dot_2_released.html :
 
 
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)
tellraj (Guest)
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
Vito
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
wecreateyou
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)
AmandaK (Guest)
A more detailed tutorial on this is needed. This may help solve my search issue as well.
 
wecreateyou
wecreateyou
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.
 
whittfield