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, 315 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 - Changing SWF File Based on Theme [ ]
 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
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Tue Nov 07, 2006 1:58 pm Reply with quoteBack to top

I am currently using three different themes on my site. I have some custom pages that I want to add a Flash animation too. The problem is I want the Flash animation to have a different look, depending on what theme is loaded. So, I made three different .swf files to handle this. On my custom module, I have the following code:

Code:
value=\"themes/BlueThemel/images/calvary.swf\"


Is there a way to pull in the theme variable that's used in Preferences so I don't have to type the theme name (in this case, Blue Theme) so that it will automatically pull in the correct .swf file based on the theme?

I found the following code in mainfile.php:

Code:
function get_theme() {
    global $user, $userinfo, $Default_Theme, $name, $op;
    if (isset($ThemeSelSave)) return $ThemeSelSave;
    if (is_user($user) && ($name != "Your_Account" OR $op != "logout")) {
        getusrinfo($user);
        if(empty($userinfo['theme'])) $userinfo['theme']=$Default_Theme;
        if(file_exists("themes/".$userinfo['theme']."/theme.php")) {
            $ThemeSel = $userinfo['theme'];
        } else {
            $ThemeSel = $Default_Theme;
        }
    } else {
        $ThemeSel = $Default_Theme;
    }
    static $ThemeSelSave;
    $ThemeSelSave = $ThemeSel;
    return $ThemeSelSave;
}


Anyone know if I can use this function in my module and then just call the theme that way?
Find all posts by DivotMakerView user's profileSend private message
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


PostPosted: Tue Nov 07, 2006 10:11 pm Reply with quoteBack to top

Try

Code:

echo "value=\"themes/" . get_theme() . "/images/calvary.swf\"";

_________________
Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Wed Nov 08, 2006 8:14 am Reply with quoteBack to top

Thank you for the reply. Earlier, I tried the following:

Code:
value=\"themes/$ThemeSel/images/calvary.swf\">


This seemed to work, but I'm going to try your method too. It's always good to have more than one way to do something.

Thanks again.
Find all posts by DivotMakerView user's profileSend private message
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


PostPosted: Wed Nov 08, 2006 5:32 pm Reply with quoteBack to top

I believe $ThemeSel is a global variable, so you should be able to use that too

_________________
Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Thu Nov 09, 2006 9:11 am Reply with quoteBack to top

A new problem has come up....I can't receive $ThemeSel from a block.
To simplify things, I'm trying to have a small picture in the block, depending on what theme is currently selected.

Here are my block contents:

Version 1:

Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

$content = "<img src=\"/themes/$ThemeSel/images/test.gif\">";


Version 2:

Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

$content = "<img src=\"themes/" . get_theme() . "/images/test.gif\">";



Neither one seems to work....It's like the block doesn't know those variables exist.
Find all posts by DivotMakerView user's profileSend private message
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Thu Nov 09, 2006 9:21 am Reply with quoteBack to top

Doh! I forgot the global $ThemeSel; line!
Find all posts by DivotMakerView user's profileSend private message
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


PostPosted: Thu Nov 09, 2006 1:40 pm Reply with quoteBack to top

Smile Yep

_________________
Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
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 - TUTTISU E-COMMERCE http://www.tuttisu.it
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.056 Seconds - 187 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::