The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Include Search on Another Page
Is there a way for me to include my forum search in another page? I've looked through the code and there are hidden attributes that have random ID's, so it makes me kind of weary.
Is it possible to add forum search, as well as Member search to another page of my website? If so have you done it and how can it be done? |
#2
|
||||
|
||||
I think if you just include globals.php you will be able to include it. I have search included on a page I wrote and it works fine (you do need to make sure to include all the hidden inputs in the form).
|
#3
|
|||
|
|||
I included global.php, and hidden input elements of the form... I get the following error on search:
Code:
Your submission could not be processed because a security token was missing or mismatched. [EDIT] Oh, I don't know if this matters... but I'm manually copying the fields from the search page to my other page to be able to format it the way I want. |
#4
|
||||
|
||||
You should copy the code for the form from the default vbulletin template because it will include the security token in it.
Did you use the 'template' in the article for How to create your own vBulletin-powered page! (uses vB templates) to start your new page? You might want to read that article. I think you need to include a new line about the security token in the php page. Take a look in that article and see if it's mentioned. edit: This article tells you what to put at the top of your page to deal with the security token - Implementing CSRF Protection in modifications |
#5
|
|||
|
|||
Thanks for the links Lynne... but my php is dieing...
Here is the top of my php file, it crashes on the require: Code:
error_reporting(E_ALL & ~E_NOTICE); define('NO_REGISTER_GLOBALS', 1); define( 'THIS_SCRIPT', "search" ); define('CSRF_PROTECTION', true); //require_once( "{$Globals['PP_PATH']}/forum/global.php" ); |
#6
|
||||
|
||||
Quote:
Code:
require_once('./global.php'); Code:
chdir('/path/to/forum/'); require('./global.php'); |
#7
|
|||
|
|||
Ya I learned that issue.. so I'm past that part... right now I'm getting the search to show up, but the values for half of the options are blank!?
Code:
chdir('/my/dir/mysite/forum/'); require('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'Test Page'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('search_forums') . '");'); EDIT: in IE, there are numerous Javascript errors when I include it as stated above... I think these are causing the problem. Another note, I'm not running this from within the vBulletin portion of my server, but one directory down. --------------- Added [DATE]1213132230[/DATE] at [TIME]1213132230[/TIME] --------------- EDIT EDIT: memberlist_search template included doesn't work either... I must be missing an include or the javascript is screwing it up? --------------- Added [DATE]1213156743[/DATE] at [TIME]1213156743[/TIME] --------------- Here's a link to the test page to see what I mean: Code:
http://www.streetstyle.com/search2.php Any help appreciated |
#8
|
||||
|
||||
Put this at the top of your headinclude template.
HTML Code:
<base href="http://www.streetstyle.com/forum/" />
|
#9
|
|||
|
|||
That didn't change anything... :-/
I've linked it back to the search_forums template, in order to work out the kinks... Here is the whole file for search2.php: Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'search2'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( 'SEARCH2', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ chdir('/my/stuffhtml/blah/forum/'); require('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'Test Page'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') .'";'); eval('print_output("' . fetch_template('search_forums') . '");'); ?> |
#10
|
||||
|
||||
So, with the script you just posted, what sort of errors or results are you getting?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|