News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Loading in Skin?

Started by Nite Phire, February 25, 2005, 07:43:21 PM

Previous topic - Next topic

Nite Phire

I'm writing a mod to display non-SMF pages in the skin, so that all the menus, clock, and all that good stuff shows up where it normally does.  The problem is, I'm not sure how to make it load in the main spot.  To see what happens, go here [nofollow] and click on the staff or FAQ button [the round ones, somewhere in the middle].  It loads up top, then where it should load it says it's unable to load the main template.  My source file is below:

<?php
/******************************************************************************
* SiteDisplay.php                                                             *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel ([email protected])                *
* =========================================================================== *
* Software Version:           SMF 1.0 RC2                                     *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by:     Lewis Media (http://www.lewismedia.com)         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

// Show the site files...
function SiteDisplay ($tare) {
$tare = array (
     
"news/news" => "news/news",
     
"paper/index" => "paper/index",
     
"staff=" => "staff",
     
"faq" => "faq",
     
"characters" => "characters",
     
"data" => "data",
     
"logs" => "logs",
     
"links" => "links",
);

include (
$_SERVER["DOCUMENT_ROOT"] . "/" . "array.php");
$tare = $_GET['tare'];
$tare = HTMLSpecialChars($tare);
     if (empty(
$tare))
        {
$tare = "news/news";}
$path = $_SERVER["DOCUMENT_ROOT"] . "/" . $tare . ".php";
include
$path;
}
?>


If anyone knows how to fix this, I'd be very grateful...

Dem0n

I suggest you upgrade from rc1.

Nite Phire

Well, that too.  Haven't gotten around to it yet.  But that won't automatically fix it, will it?

Nite Phire

Upgraded.  Didn't fix it...

Nite Phire

Oh, I made a couple small changes after the forum upgrade, but it still encounters the same problem...

<?php
/******************************************************************************
* SiteDisplay.php                                                             *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel ([email protected])                *
* =========================================================================== *
* Software Version:           SMF 1.0.2                                       *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by:     Lewis Media (http://www.lewismedia.com)         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

// Show the site files...
function SiteDisplay () {
$tare = array (
     
"news/news" => "news/news",
     
"paper/index" => "paper/index",
     
"staff=" => "staff",
     
"faq" => "faq",
     
"characters" => "characters",
     
"data" => "data",
     
"logs" => "logs",
     
"links" => "links",
);

$tare = $_GET['tare'];
$tare = HTMLSpecialChars($tare);
     if (empty(
$tare))
        {
$tare = "news/news";}
$path = $_SERVER["DOCUMENT_ROOT"] . "/" . $tare . ".php";
include
$path;
}
?>

Dem0n

It seems to me you have alot of errors on your board.

Mainly is sources/load.php Are you sure when you upgraded, you upgraded over all files?

Nite Phire

Yep, even checked in the forum maintenance section:
Load.php   1.0.2   1.0.2

I think the problem is that I don't have a sub-template for the page ... so if I do make one, how exactly would I make it and put it there...?

[Unknown]

Alright, there's a few things on this.  First, I suggest you look at:

Integrating the forum into your site...
Custom actions

Anyway... the method you're using is insecure.  I'd use:

// Show the site files...
function SiteDisplay()
{
global $context;

// This is a simple array of those pages they can access from here.
$tare = array(
'news/news',
'paper/index',
'staff',
'faq',
'characters',
'data',
'logs',
'links',
);

// If they're trying to go to a page not offered here, don't let them!!
if (empty($_GET['tare']) || !in_array($_GET['tare'], $tare))
$_GET['tare'] = 'news/news';

// Okay... start grabbing the output, so we can stick it in SMF's template system.
ob_start();
include($_SERVER['DOCUMENT_ROOT'] . '/' . $_GET['tare'] . '.php');
$context['raw_data'] = ob_get_contents();
ob_end_clean();

// Don't forget the page title!
$context['page_title'] = 'Site';

$context['sub_template'] = 'rawdata';
}


What this does is use the built in "rawdata" sub template.

-[Unknown]

Nite Phire

Oh, wow that's helpful.  Thanks.  Now I kinda sort of get it.  It was all those default skin templates that I wasn't paying attention to.  Now, it actually works.  *sighs with relief*  Well, there's hope for my plan after all...

Advertisement: