Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: Different layout only on main page  (Read 9822 times)

0 Members and 1 Guest are viewing this topic.

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Different layout only on main page
« 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
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #1 on: January 26, 2014, 09:30:22 pm »

To better explain: right menu I mean right column, where I will put different informations
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #2 on: January 27, 2014, 02:08:53 pm »

May I ask for help?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #3 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}'] = '';
    }
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #4 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


Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #5 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.
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #6 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #7 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>

     
-->
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #8 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #9 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>
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #10 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #11 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".
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #12 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #13 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.
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #14 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #15 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.
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #16 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)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #17 on: January 28, 2014, 03:02:52 pm »

Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Different layout only on main page
« Reply #18 on: January 28, 2014, 03:28:38 pm »

Yes, I would like to have them without right column
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Different layout only on main page
« Reply #19 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) {
Logged
Pages: [1] 2   Go Up
 

Page created in 0.025 seconds with 19 queries.