Requires: 4.3+
With your themes you can assign blocks to specific routes and even overwrite active blocks/controllers with your own HTML.
In order to modify an existing HTML block or controller you need to create these files within your html/ folder in your theme. For this example we are going to modify the "Friends Online" block that shows up in a users dashboard when they are logged in. This mean, we try to overwrite the HTML block file PF.Base/module/friend/template/default/block/mini.html.php. There are two ways for you to do this:
For this example, we will use static code to check. Add the code below to the file you have just created. Please note that if you have both of the files (friend.block.mini.html.php and friend.block.mini.html), the core will prefer to use the file friend.block.mini.html to overwrite.
<div class="block"> <div class="title"> Friends Online </div> <div class="content"> ... </div> </div> |
To make sure the changes take place clear your sites cache from the AdminCP.
In addition to modifying blocks you can also create a new block. Similar to apps, themes can bootstrap a PHP file called start.php. From this file you can add blocks and use any of the API Functions provided to apps.
In your theme create a file called start.php and paste the following
block(1, 'core.index-member', function() { $html = '<div class="block"><div class="title">Hello World</div><div class="content">...</div></div>'; return $html; }); |
Learn more about the block() function here.