Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
[CMS] Parent Layout Overwrite Details »»
[CMS] Parent Layout Overwrite
Version: 1.00, by civil78 civil78 is offline
Developer Last Online: Nov 2021 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 4.0.5 Rating:
Released: 07-31-2010 Last Update: 07-31-2010 Installs: 6
Uses Plugins
Code Changes  
No support by the author.

[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 Now

File Type: zip product-parrent_layout_overwrite.zip (17.5 KB, 19 views)

Screenshots

File Type: png screenshot.png (24.0 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-26-2012, 08:20 PM
zero477 zero477 is offline
 
Join Date: Jan 2012
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

It seems quite complicated ... I need to use different layouts for articles and sections ... I think it is a very obvious feature...

Can I see an example of the application??
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08079 seconds
  • Memory Usage 2,247KB
  • Queries Executed 16 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_attachment
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete