vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   call a vBUlletin PHP script from a different php script (https://vborg.vbsupport.ru/showthread.php?t=110261)

Bhuwan 03-14-2006 01:35 AM

Quote:

Originally Posted by merk
You cant have the # character in a query string. It is a delimiter that the browser uses to scroll.

That's one of the reasons why I am attempting to use an external script
that and the fact htat I don't want 20 rewrites :-)

There must be a way to handle this externally? I've done it but the Phrases don't seem to show up....

Any takers? :)

This is how I'm going to showthread.pph script from myscript.php
PHP Code:

  require_once('./global.php');
global 
$vbulletin;
 
$vbulletin->input->clean_gpc('r''goto'TYPE_STR);
 
// doing showthread.php?t=X&goto=newpost
  
$vbulletin->GPC['goto'] = 'newpost';
  
$threadid = <some real threadid here is placed as a test>;
  require_once(
'./showthread.php');
exit; 

Now -- it does work, except the PHRASES are not there (at leas tnot all of them). Only guess I've had is that global.php is being executed too early..

Any takers? Please!! :banana:

merk 03-14-2006 02:53 AM

Why are you calling anything prior to the showthread script?

Bhuwan 03-15-2006 10:25 AM

Quote:

Originally Posted by merk
Why are you calling anything prior to the showthread script?

I wanna run everythig through myscript.php using mod rewrites (for SEO). Hence the reason
Come on! Someone must have the answer!

Akex 03-15-2006 11:19 AM

You have to set up this also in the script which calls showthread

PHP Code:

// ################### 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();
 
// pre-cache templates used by specific actions
$actiontemplates = array(); 

Why ? Because, this need to be setup before global.php is calling. As it's written in your script, you call global.php (require_once mean called once and no more ...) but showthread.php won't call it (as it was already called) ... and $globaltemplates, $phrasegroups etc. won't be loaded.

The Geek 03-15-2006 03:25 PM

Try NOT including global in your header.
However that means you will need to cleanse your $_REQUEST variables manually.

Not sure if it will work, but it may. Saying that, its still kind of clunky :(

You may be better off using the global_start hook to include your code. Reason being that all your URLs will have to point to the same script which will simply encase each page.

Go with the global_start hook it will work for you in the long run.

HTHs

merk 03-15-2006 10:41 PM

I still see no reason why mod_rewrite wont work - the # character has nothing to do with server processing.

Bhuwan 03-16-2006 12:17 AM

Quote:

Originally Posted by Akex
You have to set up this also in the script which calls showthread

PHP Code:

// ################### 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();
 
// pre-cache templates used by specific actions
$actiontemplates = array(); 

Why ? Because, this need to be setup before global.php is calling. As it's written in your script, you call global.php (require_once mean called once and no more ...) but showthread.php won't call it (as it was already called) ... and $globaltemplates, $phrasegroups etc. won't be loaded.

Already thought of that but it didn't work :( Thanks tho!

Quote:

Originally Posted by The Geek
Try NOT including global in your header.
However that means you will need to cleanse your $_REQUEST variables manually.

Not sure if it will work, but it may. Saying that, its still kind of clunky :(

You may be better off using the global_start hook to include your code. Reason being that all your URLs will have to point to the same script which will simply encase each page.

Go with the global_start hook it will work for you in the long run.

HTHs

That actually worked . I suppose it is ok that i have to clean the variables myself; better than nothing :D ! :banana: thx


All times are GMT. The time now is 10:05 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.01056 seconds
  • Memory Usage 1,747KB
  • 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
  • (3)bbcode_php_printable
  • (4)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
  • (7)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