Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Confusion about extensions and controls
So ... is it possible to build a control that exists only within an extension?
I'm trying to put a little touch of HTML that appears between the Panel and Menu, or the Panel as Body as the case may be. Basically, right now the login/logout pages are templated wrong because this bit of HTML is in the "menu.php" file and doesn't get called for those pages
The documentation uses the example of PageEnd to demonstrate a simple control, but this is instantiated in the settings config file (not a big deal because it won't be overwritten), and then the actual page control is added in index.php -- which I'm trying to avoid! Here's what I've got so far.
It returns no output at the moment -- not even an error (i'm assuming because it never gets added to the page!). Is it possible to add this to the page and get it rendered from the extension, or am I going to have to hack it in?
I've done a couple searches on the community and was unable to find anything revelant.
Thanks!
I'm trying to put a little touch of HTML that appears between the Panel and Menu, or the Panel as Body as the case may be. Basically, right now the login/logout pages are templated wrong because this bit of HTML is in the "menu.php" file and doesn't get called for those pages
The documentation uses the example of PageEnd to demonstrate a simple control, but this is instantiated in the settings config file (not a big deal because it won't be overwritten), and then the actual page control is added in index.php -- which I'm trying to avoid! Here's what I've got so far.
<?php
/*
Extension Name: extra Menu
Extension Url: Custom.
Description: Adds in the top menu after the panel/head controls
Version: 0.1
*/
class GCGMenu extends Control {
function GCGMenu(&$Context) {
$this->Name = 'GCGMenu';
$this->Control($Context);
}
function Render() {
$this->CallDelegate('PreRender');
echo "Parrrrrty";
include(ThemeFilePath($this->Context->Configuration, 'gcg_menu.php'));
$this->CallDelegate('PostRender');
}
}
$PageEnd = $Context->ObjectFactory->CreateControl($Context, 'PageEnd');
$Page->AddRenderControl($PageEnd, $Configuration['CONTROL_POSITION_PANEL']+1);
?>
It returns no output at the moment -- not even an error (i'm assuming because it never gets added to the page!). Is it possible to add this to the page and get it rendered from the extension, or am I going to have to hack it in?
I've done a couple searches on the community and was unable to find anything revelant.
Thanks!
0
This discussion has been closed.
Comments
First of all, you need to make sure that you are only adding to the vanilla pages - not the login or registration pages.
Finally, you don't actually instantiate your control with that code - you are instantiating PageEnd instead. So here's what I'd do to fix it:
<?php /* Extension Name: extra Menu Extension Url: Custom. Description: Adds in the top menu after the panel/head controls Version: 0.1 */ if (in_array($Context->SelfUrl, array("index.php", "account.php", "categories.php", "comments.php", "post.php", "search.php", "settings.php"))) { class GCGMenu extends Control { function GCGMenu(&$Context) { $this->Name = 'GCGMenu'; $this->Control($Context); } function Render() { $this->CallDelegate('PreRender'); echo "Parrrrrty"; include(ThemeFilePath($this->Context->Configuration, 'gcg_menu.php')); $this->CallDelegate('PostRender'); } } $GCGMenu = $Context->ObjectFactory->CreateControl($Context, 'GCGMenu'); $Page->AddRenderControl($GCGMenu, $Configuration['CONTROL_POSITION_PANEL']+1); } ?>