forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: allvip on October 09, 2013, 04:23:11 am
-
I know that I have to creat a new div and place it in theme.php under sidebar or page footer function to show only on the index page but I gived width: 60%; float: left; to #cpg_main_block_outer and width: 40%; float: right; to my new sidebar div.
the problem now is #cpg_main_block_outer (gallery main div with categories and albums) is 60% on every page.
I think I'm using the wrong way.
Is there a way to have a custom sidebar only on the index.php page?
I know I ask a lot a questions but I'm creating a theme VERY FANCY and VERY DIFFRENT from a coppermine theme.
I will post it for free download on the forum.
-
I assume you currently added the new div block to the template.html file? If so, replace it completely with a new custom token like {MY_NEW_DIV}. Now we're able to replace that token with the help of the function pageheader.
-
yes I know that but #cpg_main_block_outer is 60% on every page.
how can I make him show 60% width on the index page and 100% width on all other pages?
without width: 60%; float: left; or just float: left; for #cpg_main_block_outer the sidebar is showing above the div not to the left.
-
Instead of hard-coding the width you also need to use a token.
[Edit: Final solution can be found here (http://forum.coppermine-gallery.net/index.php/topic,76722.msg370584.html#msg370584)]
-
to put #cpg_main_block_outer in theme.php too?
token for width?
please help
that will break all other pages.
-
I don't know where exactly you added your CSS code. Either please describe it more detailed or attach your theme to your next reply.
-
is the curve theme that I edit.
I just added to function pageheader in theme.php:
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{MY_NEW_DIV}'] = <<< EOT
<div id="divS">
</div>
EOT;
} else {
$template_vars['{MY_NEW_DIV}'] = '';
}
and {MY_NEW_DIV} before:
<div id="cpg_main_block_outer">
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
and this to style.css
#divS {
margin: 0px;
padding: 0px;
color: #000000;
background-color: #cccccc;
float: right;
width: 40%;
height: 450px;
background-image: url(../image/ad.jpg);
background-repeat: no-repeat;
}
and curve theme has #cpg_header_block_outer style for the gallery div:
#cpg_header_block_outer {
background-color: #fefefe;
background-image: none;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 0pt -633px;
padding-left: 20px;
}
-
style for #cpg_header_block_outer with width and and float adeed:
#cpg_header_block_outer {
background-color: #fefefe;
background-image: none;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 0pt -633px;
padding-left: 20px;
width: 60%;
float: left;
}
-
As I said: remove the hard-coded width: 60%; from cpg_header_block_outer. Instead, add a new token to template.html and replace it in theme.php, like
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
-
soory but I dont understand much.
I added the code: in function pageheader under :
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{MY_NEW_DIV}'] = <<< EOT
<div id="divS">
</div>
EOT;
} else {
$template_vars['{MY_NEW_DIV}'] = '';
}
but: Parse error: syntax error, unexpected '<' in /home/allvip/public_html/allvip.us/cpgz/themes/zimbio/theme.php on line 1158
with:
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = <<< EOT
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
EOT;
} else {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = '';
}
and {CPG_MAIN_BLOCK_OUTER_STYLE} before:
<div id="cpg_main_block_outer">
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
and a new style in style.css:
#cpg_header_block_outer_style {
background-color: #fefefe;
background-image: none;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 0pt -633px;
padding-left: 20px;
width: 60%;
float: left;
}
and nothing happens.
-
you got that error because the template output, you put this:
<div id= {CPG_MAIN_BLOCK_OUTER_STYLE}>
when it replaced the token, you get this:
<div id = <div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">>
Regards
-
please help me understant where should I place {CPG_MAIN_BLOCK_OUTER_STYLE}
-
to avoid the error in the output template, place it so
{CPG_MAIN_BLOCK_OUTER_STYLE}
when the token is replaced, it will show this:
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
since this is what you want for
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = <<< EOT
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
EOT;
Regards.
-
ok
added in template.html:
{CPG_MAIN_BLOCK_OUTER_STYLE}
before:
<div id="cpg_main_block_outer">
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
and in theme.php just:
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = <<< EOT
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
EOT;
and in style css:
#cpg_main_block_outer {
background-color: #ffffff;
background-image: url(images/frame_repeat.png);
background-repeat: repeat-y;
background-attachment: scroll;
background-position: left top;
padding-left: 0px;
}
.cpg_main_block_outer_style {
background-color: #000000;
background-image: url(images/frame_repeat.png);
background-repeat: repeat-y;
background-attachment: scroll;
background-position: left top;
padding-left: 0px;
width: 60%;
float: left;
}
but nothing happens
-
the main gallery block does not takes the style .cpg_main_block_outer_style that has width: 60%;
float: left;
-
the only changes in pageheader function is that I adeed:
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = <<< EOT
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
EOT;
-
{CPG_MAIN_BLOCK_OUTER_STYLE} is token to apply a new style to div cpg_main_block_outer
right?
so I create a new style in style.css .cpg_main_block_outer_style with the same name like the token and width: 60%; float: left;
but nothing
-
Now I'm out and I can not see pageheader function, I can only write in the forum.
To see the style you added in your CSS, you need this:
<div id="cpg_main_block_outer" class="cpg_main_block_outer_style">
Regards.
-
thank you,thank you...than you
andre code was goog but not perfect :)
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
need to be
<div id="cpg_main_block_outer" class="cpg_main_block_outer_style">
now the main block is 100% on the index page and 60% flot to the left on all other pages.
-
step by step to have Custom Sidebar only on the homepage:
1.add to theme.php under pageheader function (if you do not have it in ypur theme.php copy the function from themes/sample/theme.php:
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = <<< EOT
<div id="cpg_main_block_outer" class="cpg_main_block_outer_style">
EOT;
} else {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = '';
}
2. add to template.html:
{CPG_MAIN_BLOCK_OUTER_STYLE}
before:
<div id="cpg_main_block_outer" >
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
3.add to style.css or whatever the name of your css file is:
.cpg_main_block_outer_style {
width: 60%;
float: left;
}
-
thanks a lot Niecher for the class ideea
-
I never would of thing to replace style="{CPG_MAIN_BLOCK_OUTER_STYLE} from Andre code with class="cpg_main_block_outer_style"
I'm so happy and greatfull for your help
thank youuuuuuuuuuu
was very important for my new theme
-
I don't understand what you did, respectively why you did it that way. Your solution will return
<div id="cpg_main_block_outer" class="cpg_main_block_outer_style">
<div id="cpg_main_block_outer" >
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
on index.php. As you can see, you now have 2 cpg_main_block_outer blocks and I assume, only one of them get closed.
My idea was to use inline CSS instead of a new class and an additional div block. I.e. the token in
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
will be replaced the following way:
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = 'width: 60%';
} else {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = '';
}
I recommend to use that solution to get valid HTML code.
-
I think I don't understand where to put the code:
replace in template.html:
<div id="cpg_main_block_outer" >
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
with:
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
and add under function pageheader in theme.php:
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = 'width: 60%';
} else {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = '';
}
every time I delete:
[code]
<div id="cpg_main_block_outer" >
<div class="cpg_main_block_inner">
{GALLERY}
<br /> <!-- workaround for issue 64492 - do not remove the line break! -->
</div>
</div>
I get the result from the attachment.
[/code]
-
Please try to comprehend how this mod is supposed to work before randomly applying or replacing anything.
Here again the complete mod, expecting an unmodified gallery:
Open your theme's template.html file, find
<div id="cpg_main_block_outer">
(just this line!) and replace with
<div id="cpg_main_block_outer" style="{CPG_MAIN_BLOCK_OUTER_STYLE}">
Now, open your theme's theme.php file and add the following code to the pageheader function:
global $CPG_PHP_SELF;
$superCage = Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = 'width: 60%';
} else {
$template_vars['{CPG_MAIN_BLOCK_OUTER_STYLE}'] = '';
}
-
ok.it works perfect.thans a looooooooooooot.
boy I such and idiot
-
boy I am such an idiot
-
please delete all my 2 pages post
how will want to use your code will have to read 2 pages of wrong posts
-
I just added a link to the solution to my second reply.
-
great.thanks