Store
Community Documentation

v3 Knowledgebase

Quickly create a full block

Hello all,

A full block is a block that allows being drag and dropped. It follows the MVC approach used throughout the script and provides more features than a block from the adminCP.

If you have not yet created your own product please read this article for help on how to do this. If you have not yet created your own module this is a good starting point.

Now that you have both your product and your module we can begin, lets suppose your new block will be named: myBlock and that your module is named myModule and your product myProduct
Lets create a php file in
/module/myModule/include/component/block/myblock.class.php
Add the following to this file:
PHP:
<?php
defined
('PHPFOX') or exit('NO DICE!');
class 
myModule_Component_Block_myBlock extends Phpfox_Component
{
    public function 
process()
    {
     
// you add your code here
    
}    
}
?>

Please notice the name of the class, it has both myModule and myBlock. In technical terms you only need to implement the process function here.
Now you need the template counterpart, which is a php file in:
/module/myModule/template/<theme>/block/myblock.html.php
that looks like this:
PHP:
<?php
defined
('PHPFOX') or exit('NO DICE!'); 
?>
Html content goes here!


And thats all there is to create a block, now the actual code and logic depends on what you want to do and you would do well in studying the API.