MjrGaelic
09-23-2007, 05:47 PM
I have tried posting this question in the appropriate channels without the response so I'm hoping you coders can help.
This should be theoretically simple however I digress I'm not a coder and I can't resolve even a simple concept.
The task is to load sub_pages from smedd's portal and I want to do so without having to create additional php pages for each page I want to have. so, basically index.php?page=mypagename.
I'm ok with creating a page.php so that I can call out like page.php?do=mypagename etc.
I've gone through the API tutorial and while it partially works it uses the forum template not the index.php format.
Here is the code for my index.php
<?php
/*================================================= =====================*\
|| ################################################## ################## ||
|| # SmEdD's Portal # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2006 Stephen "SmEdD" Medd # ||
|| # http://www.smedd.com | stevemedd@gmail.com # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| ################################################## ################## ||
\*================================================ ======================*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'index');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array(
'newscache'
);
// pre-cache templates used by all actions
$globaltemplates = array(
'smedd_index',
'smedd_newsbits',
'smedd_header',
'smedd_footer'
);
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
// ######################### PROCESS NEWS ############################
if (!empty($vbulletin->newscache))
{
foreach ($vbulletin->newscache AS $news)
{
$vbcollapse['collapseobj_newsid'] =& $vbcollapse["collapseobj_newsbit_$news[threadid]"];
$vbcollapse['collapseimg_newsid'] =& $vbcollapse["collapseimg_newsbit_$news[threadid]"];
$show['reply-s'] = true;
if ($news['replycount'] == 1)
{
$show['reply-s'] = false;
}
$news['time'] = vbdate($vbulletin->options['timeformat'], $news['dateline']);
$news['date'] = vbdate($vbulletin->options['dateformat'], $news['dateline'], 1);
eval('$newsbits .= "' . fetch_template('smedd_newsbits') . '";');
}
// memory saving
unset($newscache, $news);
}
// #################### EVAL GLOBAL TEMPLATES #######################
// Clear the header and footer variables so we can set them again without problems!
unset($header, $footer);
$vbphrase['powered_by_vbulletin'] = "Home page powered by SmEdD's Portal, Copyright ©2006, Stephen Medd.<br />\n" . $vbphrase['powered_by_vbulletin'];
// Output all the templates
eval('$header = "' . fetch_template('smedd_header') . '";');
eval('$footer = "' . fetch_template('smedd_footer') . '";');
if ($shownewpm)
{
eval('$footer .= "' . fetch_template('pm_popup_script') . '";');
}
eval('print_output("' . fetch_template('smedd_index') . '");');
?>
I've tried adding:
if ($_REQUEST['do'] == 'ventrilo')
{
eval('print_output("' . fetch_template('page_ventrilo') . '");');
}
but nothing happens (ventrilo is the example, and the templates name is page_ventrilo)
If possible what I would like to have is a piece of code in the page that would call out custom templates.. I know vbadvanced does this seamlessly but I don't want to run vbadvanced, just syndicate news and add my own content.
Can anyone offer a suggestion or 2 to point me in the right direction?
If you need, the context of the project is here (http://www.edmontongamers.com/eodmod/forum) so you can see what I'm working towards.
Kind regards,
Ryan
This should be theoretically simple however I digress I'm not a coder and I can't resolve even a simple concept.
The task is to load sub_pages from smedd's portal and I want to do so without having to create additional php pages for each page I want to have. so, basically index.php?page=mypagename.
I'm ok with creating a page.php so that I can call out like page.php?do=mypagename etc.
I've gone through the API tutorial and while it partially works it uses the forum template not the index.php format.
Here is the code for my index.php
<?php
/*================================================= =====================*\
|| ################################################## ################## ||
|| # SmEdD's Portal # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2006 Stephen "SmEdD" Medd # ||
|| # http://www.smedd.com | stevemedd@gmail.com # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| ################################################## ################## ||
\*================================================ ======================*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'index');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array(
'newscache'
);
// pre-cache templates used by all actions
$globaltemplates = array(
'smedd_index',
'smedd_newsbits',
'smedd_header',
'smedd_footer'
);
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
// ######################### PROCESS NEWS ############################
if (!empty($vbulletin->newscache))
{
foreach ($vbulletin->newscache AS $news)
{
$vbcollapse['collapseobj_newsid'] =& $vbcollapse["collapseobj_newsbit_$news[threadid]"];
$vbcollapse['collapseimg_newsid'] =& $vbcollapse["collapseimg_newsbit_$news[threadid]"];
$show['reply-s'] = true;
if ($news['replycount'] == 1)
{
$show['reply-s'] = false;
}
$news['time'] = vbdate($vbulletin->options['timeformat'], $news['dateline']);
$news['date'] = vbdate($vbulletin->options['dateformat'], $news['dateline'], 1);
eval('$newsbits .= "' . fetch_template('smedd_newsbits') . '";');
}
// memory saving
unset($newscache, $news);
}
// #################### EVAL GLOBAL TEMPLATES #######################
// Clear the header and footer variables so we can set them again without problems!
unset($header, $footer);
$vbphrase['powered_by_vbulletin'] = "Home page powered by SmEdD's Portal, Copyright ©2006, Stephen Medd.<br />\n" . $vbphrase['powered_by_vbulletin'];
// Output all the templates
eval('$header = "' . fetch_template('smedd_header') . '";');
eval('$footer = "' . fetch_template('smedd_footer') . '";');
if ($shownewpm)
{
eval('$footer .= "' . fetch_template('pm_popup_script') . '";');
}
eval('print_output("' . fetch_template('smedd_index') . '");');
?>
I've tried adding:
if ($_REQUEST['do'] == 'ventrilo')
{
eval('print_output("' . fetch_template('page_ventrilo') . '");');
}
but nothing happens (ventrilo is the example, and the templates name is page_ventrilo)
If possible what I would like to have is a piece of code in the page that would call out custom templates.. I know vbadvanced does this seamlessly but I don't want to run vbadvanced, just syndicate news and add my own content.
Can anyone offer a suggestion or 2 to point me in the right direction?
If you need, the context of the project is here (http://www.edmontongamers.com/eodmod/forum) so you can see what I'm working towards.
Kind regards,
Ryan