vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Interrogate the URL (https://vborg.vbsupport.ru/showthread.php?t=184220)

v0xb0x 07-02-2008 08:05 PM

Interrogate the URL
 
I have a plug-in that I am hooking from global_start.

I want to call the current URL into the plug-in so that I can parse it and then run an if/then or case on it. I then want to consume the output of the plug-in in the 'header' template. I have a custom nav I am trying to populate based on the URL.

Can anyone tell me if vbulletin has a variable available that possesses the current URL in it that we can expose in global_start for these purposes?

Appreciate any help in advance.

Thanks.

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

UPDATED

I'm a little closer to this.

Inside of /includes/class_core.php I found this class:

vB_Registry

The api documentation explains that this class exposes a variable called $script.

This string is "The URL of the current page, without anything after the '?'" which is exactly what I'm after.

Now, how do I get access to that variable ($script) in a plug-in that I am hooking from global_start.

Any help is greatly appreciated.

Thank You!

Dismounted 07-03-2008 06:40 AM

Why don't use PHP's pre-defined variables - such as the $_SERVER array?

necris 07-03-2008 08:34 AM

Practical example :)

Code:

$counter_aux=preg_match  (  '/subdomain\.domainame\.com/' , $_SERVER['HTTP_HOST']);
if($counter_aux<>0){
    [whatever you want to do]
}


Dismounted 07-03-2008 10:20 AM

Make sure case is not "counted".
PHP Code:

if (preg_match('/^sub\.url\.com/i'$_SERVER['HTTP_HOST']))
{
    echo 
'Match!';




All times are GMT. The time now is 09:33 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.01007 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete