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.

Ive created my new tab.. created my blank page.. now how do I put anything in it??

edited March 2006 in Vanilla 1.0 Help
Ok so I needed an extra tab which when opened displays a page containing an iFrame. In this iFrame I will be able to easily drop in some links to a bunch of PDF files... Ive created my new tab no problem using HomeTab extension, created a new page using bits of code from the search.php, but how do I drop in the iFrame code?? Could really do with pointing in the right direction here girls n boys. Here is my new page code:: <?php include("appg/settings.php"); include("appg/init_internal.php"); // 1. DEFINE VARIABLES AND PROPERTIES SPECIFIC TO THIS PAGE // Ensure the user is allowed to view this page $Context->Session->Check(agSAFE_REDIRECT); if (!agUSE_CATEGORIES) header("location: index.php"); // Define properties of the page controls that are specific to this page $Menu->CurrentTab = "Downloads"; $Panel->CssClass = "Downloads"; $Body->CssClass = "Downloads"; // 2. CONTENT // Iframe needs to be in the body, here I guess? // 3. ADD CONTROLS $Page->AddControl("Head_Render", $Head); $Page->AddControl("Menu_Render", $Menu); $Page->AddControl("Panel_Render", $Panel); $Page->AddControl("Body_Render", $Body); $Page->FireEvents(); ?>


  • I remember Mark saying there was a blank template file laying around for this purpose...
  • Come on Mark.. show me the way.
  • MarkMark Vanilla Staff
    edited March 2006
    You need to create a control that will display your iframe and add it to the page using the $Page->AddControl method.

    This is really easy if you are using 0.9.3 because there is a generic control I've created called a Filler Control that allows you to specify any old file to use as the xhtml source. However, I assume you're working with 0.9.2, so we will need to create your control from scratch. You can do it like this:

    1. Create a new extension file for your control. Inside, do the usual rigamarole for describing your extension so that it will be added to the extension list

    2. Add a control definition to your extension file for your iframe source like this:

    // First limit this extension so that it only loads your control on your custom page: if ($Context->SelfUrl == 'your_page_name.php') { // Control definition: class MyIframe extends Control { function Render() { echo('The source code for my iframe goes here: <iframe src="somewhere.html"></iframe>'); } } // Now instantiate your control $MyIframe = $Context->ObjectFactory->NewContextObject($Context, "MyIframe"); // And add it to the page in the correct place $Page->AddControl("Body_Render", $MyIframe); }

    3. Finally, you need to navigate to the extension manager and enable your extension.

    Assuming I haven't got any typo's, that should do it.
  • edited March 2006
    That works like a dream. I will try and tweek it so I can add it to the extensions list for everyone. Cheers
This discussion has been closed.