You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 108 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - [tips] Theme Loading Problem [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
madman
Support Mod
Support Mod


Joined: Feb 15, 2004
Posts: 806


PostPosted: Mon Sep 20, 2004 3:15 pm Reply with quoteBack to top

This tips will help you to solve theme problem. Be sure to leave at least one theme exists in "themes/" directory in order this hack to work (used when no specified user themes has found). This will solve common problem when you get the following error message:
Warning: main(themes//theme.php): failed to open stream: No such file or directory...
Warning: main(themes/NOT_EXISTS/theme.php): failed to open stream: No such file or directory...

Note:
This tips has been posted by me in NukeCop's "Post Installation Help" forum.

Open mainfile.php and find the following code:
Code:
function get_theme() {
  global $user, $cookie, $Default_Theme;
  if(is_user($user)) {
    $user2 = base64_decode($user);
    $t_cookie = explode(":", $user2);
    if($t_cookie[9]=="") $t_cookie[9]=$Default_Theme;
    if(isset($theme)) $t_cookie[9]=$theme;
    if(!$tfile=@opendir("themes/$t_cookie[9]")) {
      $ThemeSel = $Default_Theme;
    } else {
      $ThemeSel = $t_cookie[9];
    }
  } else {
    $ThemeSel = $Default_Theme;
  }
  return($ThemeSel);
}


Replace with:
Code:
function get_theme()
{
  global $Default_Theme, $user, $userinfo, $mad_default_theme;

  $Default_Theme = $nuke_config['Default_Theme'];
  $ThemeSel      = (isset($mad_default_theme)) ? $mad_default_theme : '';

  if (($ThemeSel != '') && preg_match('/^[a-zA-Z0-9_-]+$/', $ThemeSel)) return $ThemeSel;
  if (!preg_match('/^[a-zA-Z0-9_-]+$/', $Default_Theme)) $Default_Theme = '';

  $ThemeSel  = $Default_Theme;
  $ThemePath = '';

  if (@file_exists('../../../includes') && @is_dir('../../../includes')) $ThemePath = '../../../';
  else if (@file_exists('../../includes') && @is_dir('../../includes')) $ThemePath = '../../';
  else if (@file_exists('../includes') && @is_dir('../includes')) $ThemePath = '../';

  if(is_user($user))
  {
    $usercookie = (is_array($user)) ? $user : explode(':', base64_decode($user));
    $theme_file = (isset($usercookie[9]) && preg_match('/^[a-zA-Z0-9_-]+$/', $usercookie[9])) ? $ThemePath . "themes/" . $usercookie[9] . "/theme.php" : '';
    if (($theme_file != '') && file_exists($theme_file)) $ThemeSel = $usercookie[9];
  }

  $theme_file = (($ThemeSel != '') && preg_match('/^[a-zA-Z0-9_-]+$/', $ThemeSel)) ? $ThemePath . "themes/" . $ThemeSel . "/theme.php" : '';

  if (($theme_file == '') || !file_exists($theme_file))
  {
    $theme_found = false;
    $hdir = @opendir($ThemePath . "themes");
    if ($hdir)
    {
      while ($file = @readdir($hdir))
      {
        if ($file == '.') continue;
        if ($file == '..') continue;
        if (!is_dir($ThemePath . "themes/" . $file)) continue;
        if (!preg_match('/^[a-zA-Z0-9_-]+$/', $file)) continue;
        if (!file_exists($ThemePath . "themes/" . $file . "/theme.php")) continue;

        $theme_found = true;
        $ThemeSel = $file;
        break(1);
      }
      @closedir($hdir);
    }
    if ($theme_found == false) die('<center><br /><br /><img border="0" src="images/logo.gif" /><br /><br /><b>Site Theme Error</b><br />Sorry we have problem with theme for this site. Please come back later.</center>');
  }

  $mad_default_theme = $ThemeSel;
  return $ThemeSel;
}

_________________
I'm Image
Find all posts by madmanView user's profileSend private messageVisit poster's websiteYahoo MessengerMSN Messenger
abracadaver
Corporal
Corporal


Joined: Aug 29, 2003
Posts: 57

Location: Katy, TX

PostPosted: Wed Sep 29, 2004 3:28 pm Reply with quoteBack to top

One of the most common problems is downloading an AutoTheme theme but not having the AutoTheme module installed.

So either download AutoTheme (best method) or delete the non-working theme and rename a working theme to the non-working theme name.

-Shawn

_________________
Get the AutoTheme HTML Theme System HERE!
Find all posts by abracadaverView user's profileSend private messageVisit poster's website
epidion
Nuke Cadet
Nuke Cadet


Joined: Feb 13, 2005
Posts: 1


PostPosted: Sun Feb 13, 2005 4:01 pm Reply with quoteBack to top

i put in your code and it got rid of the warnings and enabled the page to load. but now i cannot change the theme from the default anagram theme. any ideas?
Find all posts by epidionView user's profileSend private message
senad
Nuke Cadet
Nuke Cadet


Joined: Apr 24, 2005
Posts: 1

Location: USA

PostPosted: Sat Apr 23, 2005 11:58 pm Reply with quoteBack to top

Hi i have same problem can somebody Help me.
i got this Masage

Warning: themeheader(banners.php): failed to open stream: No such file or directory in /home/xxxxxxx/public_html/PHP/html/themes/DeepBlue/theme.php on line 59

Warning: themeheader(): Failed opening 'banners.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/xxxxxxx/public_html/PHP/html/themes/DeepBlue/theme.php on line 59

and in admin page in right seite this two Warning

Warning: Missing argument 3 for themesidebox() in /home/xxxxxx/public_html/PHP/html/themes/DeepBlue/theme.php on line 158

Fatal error: Call to undefined function: adminblock() in /home/xxxxxx/public_html/PHP/html/mainfile.php on line 467


Can somebody HELP me Please i have Fresh copy of Nuke Platinium but in Themes i dont se this " banners.php " where i can geret this page.

Thanks and Help Me?
Find all posts by senadView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.271 Seconds - 274 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::