Google

NukeCoder


View next topic
View previous topic
Post new topic   Reply to topic
Author Message
vicros




Joined: Apr 08, 2008
Posts: 19

PostPosted: Fri Feb 27, 2009 9:01 am
Reply with quote

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?
 
View user's profile Send private message
gotcha
Site Admin
Site Admin



Joined: Oct 25, 2004
Posts: 921

PostPosted: Wed Mar 04, 2009 9:38 am
Reply with quote

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 
View user's profile Send private message Visit poster's website
vicros




Joined: Apr 08, 2008
Posts: 19

PostPosted: Wed Mar 04, 2009 10:40 pm
Reply with quote

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.
 
View user's profile Send private message
gotcha
Site Admin
Site Admin



Joined: Oct 25, 2004
Posts: 921

PostPosted: Thu Mar 05, 2009 10:31 am
Reply with quote

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
 
View user's profile Send private message Visit poster's website
vicros




Joined: Apr 08, 2008
Posts: 19

PostPosted: Thu Mar 05, 2009 1:50 pm
Reply with quote

Thank you very much gotcha..works perfect...
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 5 Hours
Forums ©