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.

Getting custom tabs to display on custom pages outside of page manager extension

edited August 2006 in Vanilla 1.0 Help
I figured I should start a new discussion about this since my original topic was solved. Ok I got the adding custom pages with html thing working just fine, but now I can't get my custom tabs from the PageMng extension to show up on my custom pages. >< They show up fine on the forum, but whenever I go to a custom page that isn't in the PageMng, the custom tabs go away. Anyone know if there's a way to fix this? Here is my custom page code if that helps: <?php /* * Copyright 2003 Mark O'Sullivan * This file is part of Vanilla. * Vanilla is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. * Vanilla is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * The latest source code for Vanilla is available at * Contact Mark O'Sullivan at mark [at] lussumo [dot] com * * Description: Display and manipulate discussions */ include("../../../appg/settings.php"); $Configuration['SELF_URL'] = '1.php'; include("../../../appg/init_vanilla.php"); // 1. DEFINE VARIABLES AND PROPERTIES SPECIFIC TO THIS PAGE // Ensure the user is allowed to view this page $Context->Session->Check($Context); if (!$Configuration["USE_CATEGORIES"]) header("location:".GetUrl($Configuration, "index.php")); // Define properties of the page controls that are specific to this page $Head->BodyId = 'CategoryPage'; $Menu->CurrentTab = "anime_junction"; $Panel->CssClass = "CategoryPanel"; $Panel->BodyCssClass = "Categories"; $Context->PageTitle = $Context->GetDefinition("1"); // 2. BUILD PAGE CONTROLS // Add the custom HTML to the body class BodyContent { function BodyContent(&$Context) { $this->Context = &$Context; } function Render() { $html = '<table><center> <a href="">#</a> <a href="">A</a> <a href="">B</a> <a href="">C</a> <a href="">D</a> <a href="">E</a> <a href="">F</a> <a href="">G</a> <a href="">H</a> <a href="">I</a> <a href="">J</a> <a href="">K</a> <a href="">L</a> <a href="">M</a> <a href="">N</a> <a href="">O</a> <a href="">P</a> <a href="">Q</a> <a href="">R</a> <a href="">S</a> <a href="">T</a> <a href="">U</a> <a href="">V</a> <a href="">W</a> <a href="">X</a> <a href="">Y</a> <a href="">Z</a> </center> <p><center># Reviews <p>.hack//sign <br>.hack//Legend of The Twilight</center></table>'; echo($html); } } $BodyContent = $Context->ObjectFactory->NewContextObject($Context, 'BodyContent'); // 3. ADD CONTROLS TO THE PAGE $Page->AddRenderControl($Head, $Configuration["CONTROL_POSITION_HEAD"]); $Page->AddRenderControl($Menu, $Configuration["CONTROL_POSITION_MENU"]); $Page->AddRenderControl($Panel, $Configuration["CONTROL_POSITION_PANEL"]); $Page->AddRenderControl($NoticeCollector, $Configuration['CONTROL_POSITION_NOTICES']); $Page->AddRenderControl($BodyContent, $Configuration["CONTROL_POSITION_BODY_ITEM"]); $Page->AddRenderControl($Foot, $Configuration["CONTROL_POSITION_FOOT"]); $Page->AddRenderControl($PageEnd, $Configuration["CONTROL_POSITION_PAGE_END"]); // 4. FIRE PAGE EVENTS $Page->FireEvents(); ?>


  • Options
    ithcyithcy New
    edited August 2006
    don't have time to look at this right now, but you might want to put <code></code> tags around your code when you post here.
  • Options
    The reason the custom tabs aren't showing is because the page manager extension (tries to) open the custom pages file from the point of view of the root folder (ie. ./extensions/PageMng/CustomPages.php). As you're not in the root folder, the extension cannot find custom pages file. This can be fixed by changing in the lineif(!defined('PAGEMNG_ISAJAX')) $this->CustomPageFile = './extensions/'.PAGEMNG_FOLDER.'/'.$this->CustomPageFile;the relative path to an absolute one (eg. $Configuration['EXTENSIONS_PATH'].PAGEMNG_FOLDER.'/'.$this->CustomPageFile).

    I should change that in the extension...
  • Options
    edited August 2006
    ok so I change this line if(!defined('PAGEMNG_ISAJAX')) $this->CustomPageFile = './extensions/'.PAGEMNG_FOLDER.'/'.$this->CustomPageFile; in which file? The default.php file for the page manager extension? and what would ie want to change it to? Sorry i don't really know php.O.o

    ps: why can't i get the tags to work? lol
  • Options
    It's quite simple. You need to change the relative path to the extension dir ('./extensions/') to an absolute path ($Configuration['EXTENSIONS_PATH']);

    And you have to select html in the format options for you html to be parsed.
  • Options
    hmmm i keep getting errors when i change that line in the default.php file. here's the code:

    if(!defined('PAGEMNG_FOLDER')) define('PAGEMNG_FOLDER', 'PageMng'); if(isset($Menu) || defined('PAGEMNG_ISAJAX')) { $Context->Dictionary['PageMng_NoInputValue'] = 'You must enter a value for the Tab Name input.'; $Context->Dictionary['PageMng_AlreadyCreated'] = 'A tab of that identifier has already been created.'; $Context->Dictionary['PageMng_FileError'] = 'PAGEMANAGER ERROR: An error occured in attempting to save your tabs. '. 'Please check that your file permissions are correct and verify that PageManager::CustomPageFile (%s)'. ' is a valid file name.'; $Context->Dictionary['PageMng_NoRoles'] = 'PAGEMANAGER ERROR: No roles were found when attempting to build tab file. If the current '. 'page is not settings.php please go there now to properly create the file. If so, then, well, something\'s wrong...'; class PageManagement { var $CustomPageFile = 'CustomPages.php'; var $Tabs = 0; var $CurPage = -1; var $Roles = array(); var $SentPageID, $SentPageIndex = -1; var $TabBoxes = ''; function PageManagement(&$Context) { if(!defined('PAGEMNG_ISAJAX')) $this->CustomPageFile = $Configuration['EXTENSIONS_PATH'].PAGEMNG_FOLDER.'/'.$this->CustomPageFile; $this->Context = &$Context; $this->Tabs = $this->GetTabList(); if(defined('PAGEMNG_ISAJAX')) return; $this->SentPageID = ForceIncomingString('PageID', ''); if(!empty($this->SentPageID) && is_array($this->Tabs)) {

    here is the error I am getting when i change that line:

    Notice: Undefined variable: Configuration in /mounted-storage/home4/sub002/sc11923-BRUP/oga/Vanilla.1.0.1/extensions/PageMng/default.php on line 49
  • Options
    Oops, my bad. You would want $GLOBALS['Configuration']['EXTENSIONS_PATH'], as it's called within a function.
  • Options
    yes! thank you so much, that fixed the problem completely. ^.^ Now I should be able to resume my current project without trouble. This support community is one of the best i've seen, I get answers to questions very quickly thanks a lot. :D
This discussion has been closed.