TemplatePower Forum Forum Index TemplatePower Forum
Ask your question about TemplatePower here!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Switching assignInclude

 
Post new topic   Reply to topic    TemplatePower Forum Forum Index -> Coding Help
View previous topic :: View next topic  
Author Message
illutic



Joined: 03 Mar 2006
Posts: 3
Location: the Netherlands

PostPosted: Fri Mar 03, 2006 7:12 pm    Post subject: Switching assignInclude Reply with quote

I'm trying to make my own cms with a seperate admin section, I want to use templates for almost everything, so layoutchanges can be made easy.

I first wanted to know for sure that the layout of the cms itself looked as it should, before I started working on the admin section.
Now I'm trying to get the admin section running, i found a little problem...

In the index page of the admin section I'm using an if statement to see which page should be included, the login page, or the admin page.
The navigation is also included in the template (with assingInclude) and with the login page everything goes as it should, but when I'm logged in, the admin page doesn't work (the navigation still does).

Here's the index.php:
Code:

<?php

ob_start();

define('_ILLUTIC_CMS', true);

error_reporting(E_ALL);

include('../config.php');
include('session.php');
include('../include/class/class.Admin.inc.php');
include('../include/class/class.TemplatePower.inc.php');
include('../include/class/class.Modules.inc.php');
include('../include/class/class.TextEditor.inc.php');
include('../include/class/class.Templates.inc.php');
require('../config.lang.php');

$var = new Modules;
$text = new TextEditor;
$tpls = new Templates;
$mod = new Modules;

   $tpl = new TemplatePower('../themes/'.$var->FetchUpdateConfVar('website_theme').'/admin.tpl'); // admin template (layout)
   $tpl->assignInclude( 'pngfix', '../themes/'.$var->FetchUpdateConfVar('website_theme').'/png_fix.tpl' ); // png fix template
   $tpl->assignInclude('navigation', 'navigation.php');
   
   if ( !admin_logged() )
   {
      $tpl->assignInclude('login', 'login.php');
   }
   else
   {
      $tpl->assignInclude('AdminContent', 'content.php');
   }
   
   $tpl->prepare();
   
   $tpl->assignGlobal('root', $var->FetchUpdateConfVar('website_url'));
   $tpl->assignGlobal('adminroot', $var->FetchUpdateConfVar('website_url') . '/admin');
   $tpl->assignGlobal('themeroot', $var->FetchUpdateConfVar('website_url').'/themes/'.$var->FetchUpdateConfVar('website_theme'));
   $tpl->assignGlobal('imgroot', $var->FetchUpdateConfVar('website_url').'/themes/'.$var->FetchUpdateConfVar('website_theme').'/images');
   $tpl->assign('WebsiteTitle', $var->FetchUpdateConfVar('website_name'));
   $tpl->assign('WebsiteTitleAdmin', $var->FetchUpdateConfVar('website_name') . ' Admin');
   
   $tpl->printToScreen();

ob_end_flush();

?>


I won't show all classes and stuff, cos that's way too much code, but here's the navigation.php and content.php:

navigation.php
Code:
<?php

if ( !@$_GET['module'] )
{
   $module = 'a';
}
else
{
   $module = $_GET['module'];
}

$adm = new Admin;

   echo $adm->selectNav($module,$language);
   echo 'bla';


content.php
Code:

<?php

error_reporting(E_ALL);

if ( !@$_GET['module'] )
{
   $module = 'a';
}
else
{
   $module = $_GET['module'];
}

$adm = new Admin;

   echo $adm->selectModule($module,$language);
   echo 'bla';

?>


As you can see, navigation.php and content.php are almost identical.
The echo 'bla'; was only included because I wanted to test if the function or the inclusion failed.
Whether I'm logged in or not, the navigation.php works, when I'm logged off, the login.php is included, but when I'm logged in, I don't get to see anything! (well, only the bla of navigation.php)

I even added a new includescript block named admincontent (and for login named login), because I wanted to know if it had something to do with trying to change the file used for the same inclusion (login.php and content.php used to be called by the assignInclude content), but that didn't work either..

I really hope someone can help me on this, because I'm about to lose my mind over it..

----------------------------------------------------------------------------------
Okay, just found out that if i delete the if/else statement and only leave the assignInclude for content.php, it does work.. but how can i get it to work with the if/else statement?? Because it's critical that the admin logs in before he/she has access to the admin section...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    TemplatePower Forum Forum Index -> Coding Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group