vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   want to have duplicate forumhome page (https://vborg.vbsupport.ru/showthread.php?t=316578)

fxdigi-cash 01-11-2015 02:00 PM

want to have duplicate forumhome page
 
Hi,

I know this may sound strange, but I was trying to make a duplicate of ForumHome page/template so that I can use Forumhome to show specific forums on forum.php and Forumhome2 (for exampe) to show specific forums on say my custom page forum22.php.

I tried to use Tab forums mod here :https://vborg.vbsupport.ru/showthread.php?t=233135, but found it is not good for SEO.

now I want to know if there a way to have forumhome on many pages, not like having the same forumhome under different forum.php... Meaning I want for example to show specific forums on forum.php and then have another page say forum22.php with different forums.

so the idea is similar to forum tabs as shown in the mod above, but without using mods!!

I'm wondering is that possible?? :confused:

any idea??

Thanks,

kh99 01-11-2015 02:11 PM

Well, I'm not sure if I completely understand. But I don't see why you couldn't copy forum.php to another name, then modify it do display only certain forums. It looks like it uses $vbulletin->forumcache, so maybe near the beginning you could delete the forums you don't want to display from $vbulletin->forumcache. You said you don't want to use mods, but it might be possible to do that in a plugin using hook forumhome_start. You could check for a parameter and adjust forumcache accordingly.

But I haven't actually tried this and sometimes you run in to things that don't work like you hoped, as I'm sure you know.

nerbert 01-11-2015 02:49 PM

It happens I'm working on an update to a mod that ignores a list of forums. Here's a little code snippet for not listing selected forums:

Code:

                $ignore_array = array(11,12,23,24);    //example of forum id's you don't want to show
               
                $cache = array();
                foreach($vbulletin->forumcache AS $forumcache)
                {
                        $i = $forumcache['forumid'];
                        if(!in_array($i, $ignore_array))
                        {
                                $cache[$i] = $forumcache;
                        }
                }
                $vbulletin->forumcache = $cache;


fxdigi-cash 01-12-2015 12:01 AM

Thanks nerbert for sharing the code.

I will give it a try and see if it works.

Cheers :)

P.s: where and how do I use this code?? as a plugin? if yes, then what hook should I use with??

Quote:

Originally Posted by nerbert (Post 2531914)
It happens I'm working on an update to a mod that ignores a list of forums. Here's a little code snippet for not listing selected forums:

Code:

                $ignore_array = array(11,12,23,24);    //example of forum id's you don't want to show
               
                $cache = array();
                foreach($vbulletin->forumcache AS $forumcache)
                {
                        $i = $forumcache['forumid'];
                        if(!in_array($i, $ignore_array))
                        {
                                $cache[$i] = $forumcache;
                        }
                }
                $vbulletin->forumcache = $cache;


--------------- Added [DATE]1421029071[/DATE] at [TIME]1421029071[/TIME] ---------------

Quote:

Originally Posted by kh99 (Post 2531908)
Well, I'm not sure if I completely understand. But I don't see why you couldn't copy forum.php to another name, then modify it do display only certain forums. It looks like it uses $vbulletin->forumcache, so maybe near the beginning you could delete the forums you don't want to display from $vbulletin->forumcache. You said you don't want to use mods, but it might be possible to do that in a plugin using hook forumhome_start. You could check for a parameter and adjust forumcache accordingly.

But I haven't actually tried this and sometimes you run in to things that don't work like you hoped, as I'm sure you know.

Thanks man, kh99

I wanted to make each forum in an independent page because my forums are a lot and each has many sub-forums. so if I made each set of forums in one page, it will be easier for readers and visitors to understand what's going easily.

ok, if copying forum.php is a lot easier, then what code do I have to change in the new .php file... is it this code:

PHP Code:

foreach ($parentlist AS $forumID)
    {
        
$forumTitle =& $vbulletin->forumcache["$forumID"]['title'];
        
$navbits[fetch_seo_url('forum', array('forumid' => $forumID'title' => $forumTitle))] = $forumTitle;
    } 

HOW?? I have no clue how to start...!!

any idea??

nerbert 01-12-2015 12:47 AM

Well, you could try this:

Code:

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

                $show_array = array(11,12,23,24);    //example of forum id's you want to show
               
                $cache = array();
                foreach($vbulletin->forumcache AS $forumcache)
                {
                        $i = $forumcache['forumid'];
                        if(in_array($i, $show_array))
                        {
                                $cache[$i] = $forumcache;
                        }
                }
                $vbulletin->forumcache = $cache;

Notice I changed the code so it shows the forums you want instead of ignoring forums. (no "!" in front of in_array)

I have no idea how this is going to work. You could be in for a big complicated job. For starters every link has a base path like "http://www.my_forum.com/forum", I don't know how to get the correct path for the threads or forums in the new file/page.

fxdigi-cash 01-12-2015 01:00 AM

I tried that, but didn't work...

The previous code however worked as plugin using forumhome_start hook as suggested by kh99.

PHP Code:

$ignore_array = array(11,12,23,24);    //example of forum id's you don't want to show
        
        
$cache = array();
        foreach(
$vbulletin->forumcache AS $forumcache)
        {
            
$i $forumcache['forumid'];
            if(!
in_array($i$ignore_array))
            {
                
$cache[$i] = $forumcache;
            }
        }
        
$vbulletin->forumcache $cache

This one hide the undesired forums, but that happens in all forum.php and its duplicates. I want to avoid the delete or hide in other pages...

is there a way how to do that??

nerbert 01-12-2015 01:18 AM

Edit the THIS_SCRIPT value on the new page and enclose the code in

Code:

if(THIS_SCRIPT == 'index22')
{


}

or something like that

fxdigi-cash 01-12-2015 01:55 AM

Thanks, mate

I tried all that, but nothing worked...!!
I'm pretty sure to some level that it should work, yet no idea how

nerbert 01-12-2015 02:00 AM

Never mind the stuff above.

First divide your forums up into categories in the forum manager (you probably already have). Forget the forum home page and use copies of forumdisplay.php to display each category separately.

So make copies of forumdisplay.php with names like forum1.php, forum2.php or whatever.

In each one edit in $_REQUEST['forumid'] = 10; $_REQUEST['forumid'] = 20;, etc, whatever your category forumid's are, right under the big START MAIN SCRIPT comment block (EDITED: should be forumid's NOT threadid's)

Now go to them and see if it's all working as planned.

If all that works all you need to do is duplicate the other stuff on forum home into these new files. So copy the FORUMDISPLAY template and call it CATEGORY and at the bottom of each new file, line 1210 change

Code:

$templater = vB_Template::create('FORUMDISPLAY');
to

Code:

 
$templater = vB_Template::create('CATEGORY');

Next look at the What's Going On box on forum home and see what php code is needed to get that, copy it over from forum.php and copy the html from FORUMHOME into CATEGORY

fxdigi-cash 01-12-2015 02:28 AM

ok, great start, but quick question where to find this line as it is not shown in forumdisplay.php

PHP Code:

$_REQUEST['forumid'

I have only this code:

PHP Code:

$_REQUEST['pagenumber'

are you talking about vb4 or vb3? because I'm using vb4.2.2


All times are GMT. The time now is 04:14 PM.

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.01210 seconds
  • Memory Usage 1,767KB
  • 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
  • (6)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete