Different layout only on main page Different layout only on main page
 

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

Main Menu

Different layout only on main page

Started by qba, January 26, 2014, 11:10:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

qba

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

qba

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

qba


Αndré

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
$template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
and above, add something like
    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}'] = '';
    }

qba

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



Αndré

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.

qba

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

Αndré

Quote from: qba on January 28, 2014, 10:49:03 AM
The typical 3rd column I deleted

I assume it's this code block?
      <!--
      <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>

     
-->

qba

Yes, it was my project of third column before I asked here for help. Now it is inactive

Αndré

That's exactly the code you need to insert instead of
            <td>
                Right column here
            </td>

qba

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

Αndré

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

qba

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

Αndré

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.

qba

Whole theme in attached file (with stable 3 columns).

I didn`t restore your suggestion from first post in theme.php

Αndré

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.

qba

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)

Αndré


qba

Yes, I would like to have them without right column

Αndré

Open theme.php, find
    global $CPG_PHP_SELF;
    if ($CPG_PHP_SELF == 'index.php') {

and replace with
    global $CPG_PHP_SELF, $cat;
    if ($CPG_PHP_SELF == 'index.php' && !$cat) {