vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Change forum listing depth depending on the style (https://vborg.vbsupport.ru/showthread.php?t=184263)

necris 07-03-2008 08:15 AM

Change forum listing depth depending on the style
 
Anyone knows a simple (or not that simple) way to do this?

What I want to achieve is:

Depending on the style reduce the depth in forum listing in order to improve the usability for the users using certain devices to access the forums.

The solution might be as easy as find the hook and use something like the text below to set the var. If anyone have already done this any clue would be apreciated :)

$counter_aux=preg_match ( '/devicename\.domainname\.com/' , $_SERVER['HTTP_HOST']);
if($counter_aux<>0){
$nasty_var = 1; # Depth....
}

Thx

Dismounted 07-03-2008 10:26 AM

PHP Code:

if (STYLEID == X)
{
    
$vbulletin->options['WHATEVER_IT_IS'] = Y;



necris 07-03-2008 06:22 PM

Thanks for the info.

Finally I came up with a solution to the problem after lurking a little in the settings table of the database (easier than expected ^^ because it have a non caotic structure).

Here i leave the code just in case anyone need it.

Code:

$counter_aux=preg_match  (  '/device\.domain\.com/' , $_SERVER['HTTP_HOST']);
if($counter_aux<>0){
        $vbulletin->options['forumhomedepth'] = 2;                $vbulletin->options['forumdisplaydepth'] = 2;
        $vbulletin->options['subforumdepth'] = 0;
}

On the hook global_setup_complete.

Dismounted 07-04-2008 05:03 AM

Why don't you just use a compare, instead of a costly PCRE function?
PHP Code:

if ($_SERVER['HTTP_HOST'] == 'device.domain.com')
{
    
$vbulletin->options['forumhomedepth'] = 2;
    
$vbulletin->options['forumdisplaydepth'] = 2;
    
$vbulletin->options['subforumdepth'] = 0;




All times are GMT. The time now is 10:06 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01165 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete