CSS Style for Certain Pages CSS Style for Certain Pages
 

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

CSS Style for Certain Pages

Started by Gizmo, August 17, 2008, 03:47:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gizmo

First let me say "I hate Microsoft Internet Explorer!" >:( It sucks and you can find out why here. My biggest issue with designing or porting themes for CPG is that several pages (usermgr.php and groupmgr.php for example) are too wide to fit within a small fixed width theme of less than 600px. Because IE is not a fully CSS compliant browser, you have to add "hacks" to get it to not display scrollbars on other pages which in turn can make a mess with other complaint browsers. I'm tired of spending hours of testing themes only to find IE burps over a simple compliant scrollbar issue. OK... I'm done ranting here (almost) so on to hopefuly a simple solution.

Not being a particularly strong PHP programmer (OK, actually very weak) I could use some help with this one. What I'd like to do is create a custom token so that for certain pages it will use a CSS class that will display the scrollbars and when not on these pages use a class that won't. I could easiy do this if the user is logged in, I searched and found lots of examples for the use of "if (!USER_ID) { ..." but then the scrollbars in IE would always show in all the pages while logged in. What I'm hoping to accomplish here is to limit a certain style to certain pages. While I can give instructions with every theme on how to edit these pages since they are not in the theme directory, I'm hopeful that I can do all of this from the theme.php so that users won't have to do this.

Is something like this possible and if so, some help in coding this would be most helpful to my future theme work and my sanity.


<?php
if (page usermgr.php || groupmgr.php) { /* this is the part that I need help with */
    
<div class="content_scrollbar">
        {
GALLERY}
    </
div>
else
    <
div class="content">
        {
GALLERY}
    </
div>
EOT;

?>



Thanks,

Gizmo
Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision

Nibbler

if ($PHP_SELF == 'usermgr.php' || $PHP_SELF == 'groupmgr.php') {

or

if (in_array($PHP_SELF, array('usermgr.php', 'groupmgr.php'))) {

Gizmo

Thanks Nibbler. This got me thinking about a better solution that didn't involve messing with the {GALLERY} token. I had to read up on some PHP syntax but this gives me exactly what I wanted. This will come in very handy in dealing with these wide pages in some new themes I'm working on. Here is the code that I'm using:


function scrollbar()
{
if (in_array($_SERVER['PHP_SELF'], array('usermgr.php', 'groupmgr.php'))) {
$content = '<div id="content_scrollbar">';
} else {
$content = '<div id="content">';
}
return $content;
}


Add the token to function pageheader($section, $meta = '')
'{SCROLLBAR}' => scrollbar(),

The CSS sytles for the main content:

#content {
padding: 25px 25px 15px 25px;
width: 495px;
background: #ffffff;
clear: both;
overflow: hidden;
}

#content_scrollbar {
padding: 25px 25px 15px 25px;
width: 495px;
background: #ffffff;
clear: both;
overflow: hidden;
overflow-x: auto; /* overflow-x: auto;  handle CPG User Manager overflow with scrollbar */
}

Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision

Nibbler

Why not use "content scrollbar" for the class and then simplify the css? Also, you should use Coppermine's $PHP_SELF instead of $_SERVER['PHP_SELF'] - it will be more reliable.

Gizmo

The Wordpress themes I've ported tend to have extensive CSS styling and changing one little class throws IE into a tizzy showing the scrollbars all the time regardless of whether they're needed or not. Then you have to go in and add the typical IE hacks to stop this behavior which can then cause issues with future IE versions or worse you need to test of IE 6, 7 and now with 8 in beta. IE with a combination of tables and divs is a lot of work to hack so this solution is easy and and future proof (hopefully).

As for using Coppermine's $PHP_SELF, I don't get the correct class as it always uses the second statement. Using $_SERVER['PHP_SELF']  works so if I have it wrong I would gladly use the best solution. I just want the best solution and something I can use in future themes without days of testing and screaming at MS.
Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision