| Author |
Message |
vicros

Joined: Apr 08, 2008
Posts: 19
|
Posted:
Fri Feb 27, 2009 9:01 am |
|
I am trying to add a new block to the stand alone shop. I just want to make a simple block for links. Do i make the block in php and name it as a tpl file? or do make it a regular php block? One last thing, how would i make such a block? what code do i put? |
| |
|
|
 |
gotcha
Site Admin


Joined: Oct 25, 2004
Posts: 921
|
Posted:
Wed Mar 04, 2009 9:38 am |
|
Good question.. it isn't that hard.
You can use a template file, but in this example, we will skip that since you just want some links.
Step 1 - Create the php file:
Lets call the block "Links", so create the file app/Shop/blocks/links.php
Put the following in the created file...
| Code: |
?php
$tpl->assign('block_title', 'Edit ME');
// open block
$content = $tpl->fetch($GLOBALS['current_theme'].'/blocks/block2-open.tpl');
// set some block content
$content .= '<a>Some Link</a><br>';
// set more block content here if needed
// $content .= '';
// close block
$content .= $tpl->fetch($GLOBALS['current_theme'].'/blocks/block2-close.tpl');
// reset the block title to avoid conflicts
$tpl->assign('block_title', '');
?> |
Step 2 - Add block to database:
Go to the shop admin and "Add Block".
Fill in the fields and for the path, enter
| Code: |
app/Shop/blocks/links.php |
Let me know how it works out |
Last edited by gotcha on Thu Mar 05, 2009 10:30 am; edited 1 time in total |
|
|
 |
vicros

Joined: Apr 08, 2008
Posts: 19
|
Posted:
Wed Mar 04, 2009 10:40 pm |
|
Thanks for the help gotcha but the block does not show up, after i add it. I edited the block name in the code to links, it still does not show up. |
| |
|
|
 |
gotcha
Site Admin


Joined: Oct 25, 2004
Posts: 921
|
Posted:
Thu Mar 05, 2009 10:31 am |
|
It works, the forums just screwed the first two lines up. I have corrected it, but at the beginning it needs a < before the ?php |
| |
|
|
 |
vicros

Joined: Apr 08, 2008
Posts: 19
|
Posted:
Thu Mar 05, 2009 1:50 pm |
|
Thank you very much gotcha..works perfect... |
| |
|
|
 |
|
|