Wrapp every subcategories in diffrent divs (dinamyc id for the body ) Wrapp every subcategories in diffrent divs (dinamyc id for the body )
 

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

Wrapp every subcategories in diffrent divs (dinamyc id for the body )

Started by allvip, February 21, 2014, 06:32:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

allvip

I want to wrapp every subcategory with all subpages in his own div (menu and header included if is possible-the wrapper to start after the body tag):

Aaliyah Dana with all pages (Aaliyah Dana albums list,Photoshoot album thumbnalis,RC MTV Movie Awards 2001 album thumbnalis,Adam Sandler albums list,Just Go with it 2011 on the set stills album thumbnalis) to be wrapped in div class listA1

Adam Sandler with all pages (Adam Sandler  albums list and  albums thumbnalis) to be wrapped in div class listA2

Backstreet Boys with all pages (Backstreet Boys  albums list and  albums thumbnalis) to be wrapped in div class listB1

Aaliyah Dana Subcategory
http://allvip.us/gallery/index.php?cat=13

Adam Sandler Subcategory
http://allvip.us/gallery/index.php?cat=14

Backstreet Boys Subcategory
http://allvip.us/gallery/index.php?cat=40

allvip

#1
meta albums are not important but wood be nice to be included if possible.
displayimage.php not included


allvip

#2
SOLUTION 1 - dinamyc id for the body tag for every category and all the pages in it

cat=1 and all the albums and pages in it will have id page1, cat=2 and all the albums and pages in it will have id page2.

With firefox inspect element,firebug or view page source is possible to see the body id <body id="page1"> after using the code.

Then you can add specific rules in the .css file of your theme like this:


body#page1{background:red;}
body#page2{background:black;}
body#page1 #main_menu{color:red;font-family:Verdana,sans-serif;}


REPLACE custom text in the code like themes/your_theme_nam... with the right path.

Step 1 

Open themes/your_theme_name/theme.php and add this code to function pageheader before $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars); (copy the function pageheader from themes/sample/theme.php if is not in your theme.php) :

CODE edited 15/12/2016. The old code was wrong.


    // css mod - start
    global $cat;
    $superCage = Inspekt::makeSuperCage();

    if ($superCage->get->getRaw('file') == 'minicms/cms') {
        $current_id = $superCage->get->getInt('id');
    } elseif (!$cat) {
        $current_id = 0;
    } elseif ($cat < 0) {
        $aid = -$cat;
        $current_id = mysql_result(cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '$aid' LIMIT 1"), 0);
    } else {
        $current_id = $cat;
    }

   

    $bodyid = $current_id;
    $template_vars['{BODYID}'] = $bodyid;
    // css mod - end


Step 2

Open themes/your_theme_name/template.html

FIND


<body>


REPLACE WITH


<body id="page{BODYID}">


SOLUTION 2 - dinamyc id for the body tag for every category and every album

cat=1 will have body id pagecat_1 and album=1 with all the pages in it will have id pagealb_1, cat=2 will have body id pagecat_2 and album=2 with all the pages in it will have id pagealb_2 etc

Just replace the code from step 1 of solution 2 with this code:


    // css mod - start
        global $cat, $CPG_PHP_SELF;

    if ($cat < 0) {
        $what = 'alb_';
        $current_id = -$cat;
    } else {
        $what = 'cat_';
        $current_id = $cat;
    }
    $bodyid = $what.$current_id;
    $template_vars['{BODYID}'] = $bodyid;
   
    // css mod - end

allvip

#3
SOLUTION 3 - diffrent style sheet for each category and all the pages in it
Solution 1 is better.  Multiple style sheets will make the gallery load slower. This solution is better only if you need the pages to be very, very diffrent.

REPLACE custom text in the code like themes/your_theme_name/your_css_file.css with the right path.

Step 1

Create a folder named css in themes/your_theme_name and upload your css files in it: style_1.css, style_2.css etc. cat=1 will have style_1,cat=2 will have style_2 etc

Step 2

Open themes/your_theme_name/theme.php and add this code to function pageheader before $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars); (copy the function pageheader from themes/sample/theme.php if is not in your theme.php) :

CODE edited 15/12/2016. The old code was wrong.


    // css mod - start
    global $cat;
    $superCage = Inspekt::makeSuperCage();

    if ($superCage->get->getRaw('file') == 'minicms/cms') {
        $current_id = $superCage->get->getInt('id');
    } elseif (!$cat) {
        $current_id = 0;
    } elseif ($cat < 0) {
        $aid = -$cat;
        $current_id = mysql_result(cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '$aid' LIMIT 1"), 0);
    } else {
        $current_id = $cat;
    }

   

    If (!empty($cat)) {
    $cssfile = "<link rel=\"stylesheet\" href=\"themes/your_theme_name/style_{$current_id}.css\" type=\"text/css\" />";
} else {$cssfile = "<link rel=\"stylesheet\" href=\"themes/your_theme_name/your_main_css_file.css\" type=\"text/css\" />";}
    $template_vars['{CSSFILE}'] = $cssfile;
    // css mod - end


Step 3

Open themes/your_theme_name/template.html

FIND


<link rel="stylesheet" href="themes/your_theme_name/your_css_file.css" type="text/css" />


REPLACE WITH:


{CSSFILE}


SOLUTION 4 - diffrent style sheet for every category and every album.

Step 1

Same as solution 3 step 1 but diffrent names for the css files like this:

cat=1 will take from the css folder style_cat_1.css and album=1 with all the pages in it will have style_alb_1.css, cat=2 will have style_cat_2.css and album=2 with all the pages in it will have style_alb_1.css etc

Step 2

Just replace step 2 from solution 3 with this code


    // css mod - start
        global $cat, $CPG_PHP_SELF;

    if ($cat < 0) {
        $what = 'alb_';
        $current_id = -$cat;
    } else {
        $what = 'cat_';
        $current_id = $cat;
    }

   
If (!empty($cat)) {
    $cssfile = "<link rel=\"stylesheet\" href=\"themes/your_theme_name/style_{$what}{$current_id}.css\" type=\"text/css\" />";
} else {$cssfile = "<link rel=\"stylesheet\" href=\"themes/your_theme_name/your_main_css_file.css\" type=\"text/css\" />";}
    $template_vars['{CSSFILE}'] = $cssfile;
    // css mod - end


allvip

How can I exclude displayimage.php ( I want displayimage.php to have no id for the body tag)

ΑndrĂ©

Quote from: allvip on February 21, 2014, 04:39:48 PM
How can I exclude displayimage.php

Wrap your echo in something like
global $CPG_PHP_SELF;
if ($CPG_PHP_SELF != 'displayimage.php') {
    // echo solution 1 or 2
}