Thread: vBindex v2.1
View Single Post
  #1484  
Old 07-31-2003, 02:40 PM
mccollin mccollin is offline
 
Join Date: Jul 2003
Location: North Carolina, USA
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, that works great. In case anyone else is following this discussion, I'll summarize and add in a few details to your last suggestion. This example may not even make sense to do, but it covers all the things you need in order to have multiple forums, multiple templates working together, and called from a single vbindex.php file.

The scenario is this...

You have a vBulletin that is focused on cars. You want to create a home page that shows all the news for all the cars. You also want "portal" pages where each car owner can see just news about their brand of car... chevy owners see chevy news, ford owners see ford news, etc. You can use the concepts here to expand this into covering the whole range of things that you might want to tailor on a portal page. My motivation was to figure out news first.

This documents what I found out. Many thanks to the great and mighty NTLDR, for creating a script that is easy to understand and work with, and for being willing to help someone that dares to alter their work! :banana:

Make the following changes in vbindex.php

FIND:

PHP Code:
$templatesused.=',home_shoutbox,home_postshout'
ADD AFTER:
PHP Code:
$templatesused.=',home_extra_chevy,home_chevy_news,home_chevy_newsbits';
$templatesused.=',home_extra_ford,home_ford_news,home_ford_newsbits';
$templatesused.=',home_extra_dodge,home_dodge_news,home_dodge_newsbits'
FIND:

PHP Code:
require('./global.php'); 
ADD AFTER:

PHP Code:
// Set variables for this page 

if ($mode=='') { 
  
$newsforum '3, 5, 8, 9'
  
$page ''
} elseif (
$mode=='chevy') { 
  
$newsforum '3'
  
$newsposts '10';
  
$page 'chevy';       
  
$news_template "home_chevy_news"
  
$newsbits_template "home_chevy_newsbits"

} elseif (
$mode=='ford') { 
  
$newsforum '5, 8'
  
$newsposts '10';
  
$page 'ford'
  
$news_template "home_ford_news"
  
$newsbits_template "home_ford_newsbits"
} elseif (
$mode=='dodge') { 
  
$newsforum '9'
  
$newsposts '10';
  
$page 'dodge'
  
$news_template "home_dodge_news"
  
$newsbits_template "home_dodge_newsbits"
} else { 
  
$newsforum $newsforum
  
$newsposts $newspost;
  
$page ''
  
$news_template "home_news"
  
$newsbits_template "home_newsbits"

FIND:

PHP Code:
WHERE forumid '$newsforum' 
REPLACE WITH:

PHP Code:
WHERE forumid in ($newsforum
Then go into the admin control panel and setup a default configuration. You can put in multiple forums for default news like this:

Quote:
3, 5, 8, 9
Then create the following templates...

home_extra_chevy (copy of home)
home_chevy_news (copy of home_news)
home_chevy_newsbits (copy of home_newsbits)
home_extra_ford (copy of home)
home_ford_news (copy of home_news)
home_ford_newsbits (copy of home_newsbits)
home_extra_dodge (copy of home)
home_dodge_news (copy of home_news)
home_dodge_newsbits (copy of home_newsbits)

This assumes that there were already the following news forums:
Chevy News - forum number 3
Ford New Car News - forum number 5
Ford Antique News - forum number 8
Dodge News - forum number 9

Edit the custom templates to your liking.

Then upload the new vbindex.php... you could call it something like cars.php.

Then, if you called cars.php with no parameters, you'd get all the news and use the standard templates.

If you called cars.php?mode=chevy, you'd get the chevy news and use the appropriate news templates.

etc, etc,

Like I said, this is a fictional example to show how to do multiple forums and multiple templates from one vbindex.php. If you wanted separate *.php files, like chevy.php, ford.php, etc., then you would do the same changes and drop the conditional logic. If you want to alter more template, then you would make the same template changes shown...
1. create the new template and copy the orginal
2. add it in the list of templates at the top of the page
3. add it to the conditional logic

This could be used to run targeted banners for each car type, or to include colors and images to match a particular theme.

If anyone finds any mistakes with this, let me know and I'll edit it.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01239 seconds
  • Memory Usage 1,816KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete