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 www.lussumo.com * 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="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/1/1.php">#</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/A/A.php">A</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/B/B.php">B</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/C/C.php">C</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/D/D.php">D</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/E/E.php">E</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/F/F.php">F</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/G/G.php">G</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/H/H.php">H</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/I/I.php">I</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/J/J.php">J</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/K/K.php">K</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/L/L.php">L</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/M/M.php">M</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/N/N.php">N</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/O/O.php">O</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/P/P.php">P</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/Q/Q.php">Q</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/R/R.php">R</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/S/S.php">S</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/T/T.php">T</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/U/U.php">U</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/V/V.php">V</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/W/W.php">W</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/X/X.php">X</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/Y/Y.php">Y</a> <a href="http://oga.mmorpgnut.com/Vanilla.1.0.1/Anime_Junction/Anime_Reviews/Z/Z.php">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(); ?>

Comments

  • 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.
  • 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...
  • 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
  • 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.
  • 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
  • Oops, my bad. You would want $GLOBALS['Configuration']['EXTENSIONS_PATH'], as it's called within a function.
  • 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.