Back to vBulletin 4.x Add-ons

[CMS] Parent Layout Overwrite
Mod Version: 1.00, by civil78

vB Version: 4.0.5 Rating: (0 vote - 0 average) Installs: 6
Released: 01 Aug 2010 Last Update: 01 Aug 2010 Downloads: 21
Not Supported Uses Plugins Code Changes  

[CMS] Parent Layout Overwrite
Created by civil78

The problem :

Sometimes a vbulletin web developer wants to have different layout in section pages and article pages. In vbulletin there is no setting for that and the article pages uses the parent (section that belongs) layout.

How it works :

This product overwrites the layout of specific nodes by replacing the parent layout globally or for specific sections.

Installation
  • Import product product-parrent_layout_overwrite
  • Edit File @root@\packages\vbcms\item\content.php
  • Find function getLayoutId() and inside function add this

Edit 01

AFTER:

PHP Code:
$this->Load(); 

ADD :

PHP Code:
// PLO - EDIT START            
        
$plo_originallayoutid $this->layoutid;
// PLO - EDIT END 

Edit 02

BEFORE:

PHP Code:
return $this->layoutid

ADD :

PHP Code:
// PLO - EDIT START    
        
global $vbulletin;
        if ((
$vbulletin->options['plo_active']) && ($vbulletin->options['plo_overwrite_lid']) && (!$plo_originallayoutid)) {
            if (
$vbulletin->options['plo_parent_lid']) {
                if (
$this->layoutid == $vbulletin->options['plo_parent_lid']) {
                    
$this->layoutid $vbulletin->options['plo_overwrite_lid'];
                }     
            } else {
                
$this->layoutid $vbulletin->options['plo_overwrite_lid']; 
            }    
        }
// PLO - EDIT END 

The final code looks like this (on 4.0.5)

PHP Code:
    public function getLayoutId()
    {
        
$this->Load();
        
// PLO - EDIT START            
        
$plo_originallayoutid $this->layoutid;
// PLO - EDIT END

        
if (!$this->layoutid)
        {
            
//If our parent doesn't have the style defined, we need to go up the chain until we find one.
            
if (! ($record vB::$vbulletin->db->query_first("SELECT layoutid FROM " TABLE_PREFIX "cms_node AS node
                    WHERE (" 
.
                
$this->nodeleft " BETWEEN node.nodeleft AND node.noderight) AND layoutid > 0 ORDER BY nodeleft DESC LIMIT 1" ))
                or
                (! 
intval($record['layoutid'])))
            {
                
//There appears to be nothing defined. All we can do is pull the first record.
                
$record vB::$vbulletin->db->query_first("SELECT layoutid FROM " TABLE_PREFIX "cms_layout LIMIT 1" );
            }

            
$this->layoutid $record['layoutid'];
        }
        
// PLO - EDIT START    
        
global $vbulletin;
        if ((
$vbulletin->options['plo_active']) && ($vbulletin->options['plo_overwrite_lid']) && (!$plo_originallayoutid)) {
            if (
$vbulletin->options['plo_parent_lid']) {
                if (
$this->layoutid == $vbulletin->options['plo_parent_lid']) {
                    
$this->layoutid $vbulletin->options['plo_overwrite_lid'];
                }     
            } else {
                
$this->layoutid $vbulletin->options['plo_overwrite_lid']; 
            }    
        }
// PLO - EDIT END

        
return $this->layoutid;
    } 
  • Go to Vbulletin settings and on setting group "Parent Layout Overwrite" change the settings.

Also if you have 4.0.5 version (but only that) you can just upload the files inside "upload (only for vbulletin 405)" folder of the zip file.

Remember if you upgrade the vbulletin to new version you have to make these edits again.

Instructions

Go to vBulletin Options --> Parent Layout Overwrite

First activate the product
  1. If you want to overwrite all the empty node layouts (that means all the nodes even 'PHP Direct Evaluation' and 'Static Page' but not the sections pages) leave empty the "Parent Layout" and set the "Overwrite Layout".
  2. If you want to overwrite only the node under sections with specific layout (for example only articles) set "Parent Layout" and "Overwrite Layout"
  3. If you leave empty both the "Parent Layout" and "Overwrite Layout", nothing will change.

Difficulty: Normal - Need to be little familiar with php

Time to install: 3-4 minutes.

History
1.0 - 01/08/2010 - Initial release.

P.S. This mod tested on 4.0.5 version but maybe run and on older versions.

Download

File Type: %1$s product-parrent_layout_overwrite.zip (17.5 KB, 21 downloads)

Screenshots

Click image for larger version
Name:	screenshot.png
Views:	183
Size:	24.0 KB
ID:	120315  


vblts.ru supports vBulletin®, 2022-2024