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.
adding a page that lives in Extensions, but acts like vanilla
ithcy
New
i'm trying to build an extension for 0.9.3+ that will be a completely new vanilla page. i want it to have the header, topmenu, sidebar, footer, etc. but i want to keep it all inside its own Extensions folder for maintenance purposes.
i understand how to add a tab that links to a new page. but is it possible to make that page stay inside the Extensions folder, yet act like vanilla?
i'm probably not making this clear. i want something like the discussions or categories page with my own content.
0
This discussion has been closed.
Comments
if (!@$Context) { include_once("../../appg/settings.php"); include_once("../../appg/init_vanilla.php"); }
along with bergamot's suggestions, it might work. thanks guys.
p.s. is your name meant to be spelt wrong? whats the story?
but i'm having much more luck just looking at categories.php and discussions.php, which is what i should have done in the first place.
weren't you on o8 when i was there? my name was itchy, and i quit for a while, and lentil started a petition thread to get me to come back, but she spelt it 'bring back ithcy' by mistake, and so when i came back i called myself ithcy as a joke and i kept it.
i'm really close to having it done already.
but about this line:
// 2. BUILD PAGE CONTROLS $ExtensionPage = $Context->ObjectFactory->CreateControl($Context, 'Filler', 'extension_page.php');
it appears to be pulling the filler content ("This page can be used by extension authors...") from themes/vanilla/templates/extension_page.php
i just want to create the filler inside my extension. Can i invoke CreateControl() in that way? i know i need to make $ExtensionPage in such a way that AddRenderControl() and FireEvents() know what to do with it.
But basically you'll have to create your own custom control and use that instead of the Filler control. As long as your page sends a PostBackAction and only displays if that action is found in the querystring, the extensionpage control will not reveal itself.
i made a custom control
class FTPList extends Control { function Render() { $FileList = "Blah"; $this->Context->Writer->Write($FileList); } }
instantiate it and add it to Page:
$FTPList = $Context->ObjectFactory->NewContextObject($Context, "FTPList"); $Page->AddRenderControl($FTPList, $Configuration['CONTROL_POSITION_BODY_ITEM']);
along with all the head, menu, panel, etc. controls
and fire the page events
$Page->FireEvents();
which gives me a nicely formed vanilla page but the body contains this error:
Fatal error: Call to a member function on a non-object in /home/stabbe2/public_html/sm/extensions/FilesTab/default.php on line 89
and line 89 is up there at the top: $this->Context->Writer->Write($FileList);
argh
Add this to your control:
function FTPList(&$Context) { $this->Name = 'FTPList'; $this->Control($Context); }
function Render() { if ($this->PostBackAction == 'FTPList') { $FileList = "Blah"; $this->Context->Writer->Write($FileList); } }
And finally, you don't need to use the Writer to write your control. That class is actually deprecated in 0.9.3 since it was just extra work for the server and never really used in the way I had imagined it. So...
function Render() { if ($this->PostBackAction == 'FTPList') { $FileList = "Blah"; echo($FileList); } }
so now i've got
class FTPList extends Control { function FTPList(&$Context) { $this->Name = 'FTPList'; $this->Control($Context); } function Render() { if ($this->PostBackAction == 'FTPList') { $FileList = "Blah"; echo($FileList); } } } $FTPList = $Context->ObjectFactory->NewContextObject($Context, "FTPList"); $Page->AddRenderControl($Head, $Configuration['CONTROL_POSITION_HEAD']); $Page->AddRenderControl($Menu, $Configuration['CONTROL_POSITION_MENU']); $Page->AddRenderControl($Panel, $Configuration['CONTROL_POSITION_PANEL']); $Page->AddRenderControl($FTPList, $Configuration['CONTROL_POSITION_BODY_ITEM']); $Page->AddRenderControl($Foot, $Configuration['CONTROL_POSITION_FOOT']); $Page->AddRenderControl($PageEnd, $Configuration['CONTROL_POSITION_PAGE_END']); $Page->FireEvents();
and what it does:
shows me the discussions page.
argh again.
thanks for your help, mark.
just in case
Can you post the entire contents of your file?