Hello,
I know you cannot have an include statement within an echo, but that's a problem I'm stuck on. I'm trying to have the Fusion News include statement load as my default page, but my current site structure is pretty forbidding.
Here's my main index function which determines which content page to load:
<?PHP
$default = 'content/news/news.php';
$page_Header = $page_Text = '';
function loadInclude($file, $default, $dir='content/')
{
global $page_Header, $page_Text;
if(substr($dir, -1) != '/') $dir .= '/';
if(empty($file) || !$file) $file = $default;
if(!file_exists($dir . $file . '.php')) $file = $default;
// echo 'Including: ' . $dir . $file . '.php<br />';
include($dir . $file . '.php');
}
if(isset($_GET['id']))
loadInclude($_GET['id'], 'news/news', 'content/');
elseif(isset($_GET['b']))
loadInclude($_GET['b'], 'index', 'content/products/books/');
elseif(isset($_GET['cl']))
loadInclude($_GET['cl'], 'index', 'content/products/clothing/');
elseif(isset($_GET['co']))
loadInclude($_GET['co'], 'index', 'content/products/collectibles/');
elseif(isset($_GET['g']))
loadInclude($_GET['g'], 'index', 'content/products/games/');
elseif(isset($_GET['mi']))
loadInclude($_GET['mi'], 'index', 'content/products/misc/');
elseif(isset($_GET['ms']))
loadInclude($_GET['ms'], 'index', 'content/products/ms/');
elseif(isset($_GET['p']))
loadInclude($_GET['p'], 'index', 'content/products/posters/');
elseif(isset($_GET['t']))
loadInclude($_GET['t'], 'index', 'content/products/toys/');
else include $default;
include('layout/before.php');
echo $page_Header;
include('layout/space.php');
echo $page_Text;
include('layout/after.php');
?>
As you can see, right now the default echos $page_Header and $page_Text from content/news/news.php which works fine with plain html, but Fusion News is loaded by an include statement, and obviously I can't have the include being echoed in by the $page_text.
So, not knowing too much about PHP, I'm kind of stuck. Is it possible to alter the function so that if no variable is present, rather than echoing $page_Text of the default page, the Fusion News include is instead loaded?