Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2008, 02:28 PM
zivester zivester is offline
 
Join Date: May 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 06-10-2008, 02:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #3  
Old 06-10-2008, 03:37 PM
zivester zivester is offline
 
Join Date: May 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Actually, if I include global.php from the forums, my page doesn't load... (btw I'm modding a photopost page to include the forum search).


[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.
Reply With Quote
  #4  
Old 06-10-2008, 05:01 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 06-10-2008, 06:27 PM
zivester zivester is offline
 
Join Date: May 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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" );
Reply With Quote
  #6  
Old 06-10-2008, 07:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by zivester View Post
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" );
Have you tried changing the require_once to include the actual path and see if that works? Is this page you are adding in the forum directory? If so, just include it like this:
Code:
require_once('./global.php');
If it's in a different directory, then do a chdir first, like this:
Code:
chdir('/path/to/forum/');
require('./global.php');
Reply With Quote
  #7  
Old 06-10-2008, 07:29 PM
zivester zivester is offline
 
Join Date: May 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 06-11-2008, 07:12 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Put this at the top of your headinclude template.
HTML Code:
<base href="http://www.streetstyle.com/forum/" />
Reply With Quote
  #9  
Old 06-11-2008, 01:03 PM
zivester zivester is offline
 
Join Date: May 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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') . '");');
                                                                                                                                                    
?>
Reply With Quote
  #10  
Old 06-11-2008, 01:58 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, with the script you just posted, what sort of errors or results are you getting?
Reply With Quote
Reply


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 12:23 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.08017 seconds
  • Memory Usage 2,277KB
  • Queries Executed 11 (?)
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
  • (8)bbcode_code
  • (1)bbcode_html
  • (1)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
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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_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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete