[Solved]: Checking which theme in PHP [Solved]: Checking which theme in PHP
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Solved]: Checking which theme in PHP

Started by steveeh131047, March 22, 2008, 09:53:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

steveeh131047

I'm generating dynamic content with some PHP invoked through {CUSTOM_HEADER}. The generated content needs to be slightly different between two different themes. Is there any cpg variable the PHP can check to know which theme is running?

Sami

There is a global array ($CONFIG) that gets its values under include/init.inc.php
You can find theme value by checking this:

$CONFIG['theme']
‍I don't answer to PM with support question
Please post your issue to related board

steveeh131047

Sami, I'm relatively new to PHP.

Just to test the variable I tried:

global $CONFIG['theme'];
echo $CONFIG['theme'];

but I got a syntax error.
Have I missed something obvious?

steveeh131047

Sami, Now OK.

Just realised the global declaration should have been:

global $CONFIG;

Thanks for your help

Sami

Yes ,To use a global variable under a function you need to declare it as a global under that function
for more info check this :
http://us2.php.net/global
‍I don't answer to PM with support question
Please post your issue to related board

steveeh131047

Sami,

Yes, I remembered I needed the global declaration, but I hadn't realised I needed to delare the array name rather than just the specific array index. With you guys' help and support it's all working nicely now.

My original implementation of CPG is at:
http://www.miltonmalsorhistory.org.uk/gallery/index.php?theme=mmhs

but my new theme integrates it into the site better:
http://www.miltonmalsorhistory.org.uk/gallery/index.php?theme=mmhs2

I've still got some "tidying up" to do, but it should all be "downhill" from here.

Thanks again for a great script.