forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: qba on January 26, 2014, 11:10:14 am

Title: Different layout only on main page
Post by: qba on January 26, 2014, 11:10:14 am
Hi,
Layout of my website is as follows: on left Menu, and center/right is Content ({GALERY}).
This shape is fine for albums and photos.

My problem is that I would like to have only on main page also second MENU on right (Left: Menu | Center: Contnent | Right: Menu).
I tried to create simple table in template.html but this solution keeps Menu on right also for albums and photos pages.

May I ask you for help?

My website is: www.autoarchiwum.pl
Title: Re: Different layout only on main page
Post by: qba on January 26, 2014, 09:30:22 pm
To better explain: right menu I mean right column, where I will put different informations
Title: Re: Different layout only on main page
Post by: qba on January 27, 2014, 02:08:53 pm
May I ask for help?
Title: Re: Different layout only on main page
Post by: Αndré on January 27, 2014, 03:36:38 pm
Instead of adding the third column to template.html I'd add a new token (e.g. {RIGHT_COLUMN}). This token will be replaced later in theme.php with the help of the function pageheader.

Copy the function pageheader from themes/sample/theme.php to your theme's theme.php file, if it doesn't exist. Then, find
Code: [Select]
$template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);and above, add something like
Code: [Select]
    global $CPG_PHP_SELF;
    if ($CPG_PHP_SELF == 'index.php') {
        $template_vars['{RIGHT_COLUMN}'] = <<< EOT
            <td>
                Right column here
            </td>
EOT;
    } else {
        $template_vars['{RIGHT_COLUMN}'] = '';
    }
Title: Re: Different layout only on main page
Post by: qba on January 27, 2014, 06:23:55 pm
Thank you

I made according to your proposal but there is mistake:

1) when in template.html is
Quote
{RIGHT_COLUMN}
{MESSAGE_BLOCK}
{GALLERY}

or

Quote
{MESSAGE_BLOCK}
{RIGHT_COLUMN}
{GALLERY}


see file 1.jpg



2) when in template.html is
Quote
{MESSAGE_BLOCK}
{GALLERY}
{RIGHT_COLUMN}

see file 2.jpg


Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 09:47:57 am
I assumed you already added a third column to your template.html file. Obviously this is not the case, so we priorly need to figure out how to add the new column in general.

As you use a customized theme, please attach it as zip file to your next reply if you need help to add the column.
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 10:49:03 am
In attachment is my file.

I tried to move {right_column} to differnt places and the new column (menu) has been shown with succes on top, on bottom and on left. Unfortunately without success on right :(

The typical 3rd column I deleted
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 10:59:02 am
The typical 3rd column I deleted

I assume it's this code block?
Code: [Select]
      <!--
      <table>
      <tr>
      <td width="100%" valign="top">
      {GALLERY}
      </td>
      <div  class="links">
      <td width="350">
     
<script type="text/javascript" src="http://www.rssfeedconverter.com/services/rss-converter/52e536215ae64/snippet2531-20140126"></script>

      </div>
      </td> </tr> </table>

     
-->
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 11:19:31 am
Yes, it was my project of third column before I asked here for help. Now it is inactive
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 11:26:37 am
That's exactly the code you need to insert instead of
Code: [Select]
            <td>
                Right column here
            </td>
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 11:40:51 am
But your solution keeps third column for all pages?
I need it only on main page (home). Therefore you sent proposal of code to theme.php and token {right_column}

Then I put token to <td> (<td>{right_column}</td>) then center column is empty and all content from center is placed in right column
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 11:43:55 am
I don't know what "main page" means for you. The third column is currently applied to all index.php pages. If that's not what you want, we need to adjust the code, e.g. to display the third column just if the category id is "0".
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 11:56:39 am
I think tah your first idea with code for theme.php is correct but there is mistake in template.html (something wrong in html rules..)

In attachment I show what I would like to get
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 12:25:06 pm
I know exactly what you want to accomplish. As it seems that you already had a working third column (which is displayed on all pages), please restore that version of your theme and attach the whole theme (not just template.html) as zip file to your next reply.
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 12:51:54 pm
Whole theme in attached file (with stable 3 columns).

I didn`t restore your suggestion from first post in theme.php
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 01:48:49 pm
Attached are the modified template.html and theme.php files. As {RIGHT_COLUMN} is placed after {GALLERY}, we need to adjust pagefooter instead of pageheader. Sorry for the confusion.
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 02:50:22 pm
Thank you very much! Your help is priceless!

Is it big touble for you to make invisible right column also in Album List page?

(see www.autoarchiwum.pl)
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 03:02:52 pm
Album List page?
Do you mean pages like http://www.autoarchiwum.pl/index.php?cat=15 ?
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 03:28:38 pm
Yes, I would like to have them without right column
Title: Re: Different layout only on main page
Post by: Αndré on January 28, 2014, 03:47:20 pm
Open theme.php, find
Code: [Select]
    global $CPG_PHP_SELF;
    if ($CPG_PHP_SELF == 'index.php') {
and replace with
Code: [Select]
    global $CPG_PHP_SELF, $cat;
    if ($CPG_PHP_SELF == 'index.php' && !$cat) {
Title: Re: Different layout only on main page
Post by: qba on January 28, 2014, 03:55:22 pm
Thank you very much!

Thanks to you my website is still better and more functional!

PS. I added special thanks to my footer ;)