Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: CSS Style for Certain Pages  (Read 4947 times)

0 Members and 1 Guest are viewing this topic.

Gizmo

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1015
    • BullsEye Photos
CSS Style for Certain Pages
« on: August 17, 2008, 03:47:18 pm »

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.

Code: [Select]
<?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
Logged
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

  • Guest
Re: CSS Style for Certain Pages
« Reply #1 on: August 17, 2008, 04:06:36 pm »

Code: [Select]
if ($PHP_SELF == 'usermgr.php' || $PHP_SELF == 'groupmgr.php') {
or

Code: [Select]
if (in_array($PHP_SELF, array('usermgr.php', 'groupmgr.php'))) {
Logged

Gizmo

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1015
    • BullsEye Photos
Re: CSS Style for Certain Pages
« Reply #2 on: August 18, 2008, 03:12:22 am »

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:

Code: [Select]
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 = '')
Code: [Select]
'{SCROLLBAR}' => scrollbar(),
The CSS sytles for the main content:
Code: [Select]
#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 */
}
Logged
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

  • Guest
Re: CSS Style for Certain Pages
« Reply #3 on: August 18, 2008, 10:15:52 am »

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.
Logged

Gizmo

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1015
    • BullsEye Photos
Re: CSS Style for Certain Pages
« Reply #4 on: August 19, 2008, 02:19:26 am »

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.
Logged
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
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.