Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2015, 02:00 PM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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??

any idea??

Thanks,
Reply With Quote
  #2  
Old 01-11-2015, 02:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
MarkFL
  #3  
Old 01-11-2015, 02:49 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
Reply With Quote
3 благодарности(ей) от:
fxdigi-cash, kh99, MarkFL
  #4  
Old 01-12-2015, 12:01 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 View Post
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 View Post
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??
Reply With Quote
  #5  
Old 01-12-2015, 12:47 AM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 01-12-2015, 01:00 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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??
Reply With Quote
  #7  
Old 01-12-2015, 01:18 AM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Code:
if(THIS_SCRIPT == 'index22')
{


}
or something like that
Reply With Quote
  #8  
Old 01-12-2015, 01:55 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, mate

I tried all that, but nothing worked...!!
I'm pretty sure to some level that it should work, yet no idea how
Reply With Quote
  #9  
Old 01-12-2015, 02:00 AM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 01-12-2015, 02:28 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

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 10:55 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.04769 seconds
  • Memory Usage 2,280KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete