Ok, I tried that out. The first one did indeed echo, but the second one didn't. So this means I need to go into the php.ini config file and change something? I can't seem to find this php.ini. Should I be looking somewhere?
Edit: It works now! Before in my plugin I was putting the entire path in (http://www.yoursite.com/forum/test.php). So I just changed it to "../forum/test.php" and it works! So it must be a problem with the php.ini. I looked around and it sounds like it is a real huge pain to mess with. Unless it is simple, I will just remember to not put the full path in. |
Yes, theres a setting in php.ini to allow scripts to be passed over http
I'm not sure exactly where it is, but I had to do the same before some of my scripts would run properly on my server You need to set php to include through HTTP , ie: allowing remote files to be included Some info is available here. http://www.php.net/manual/en/features.remote-files.php |
You can't include a php file using it's remote (http) address EVER. It will never work that way. PHP files are executed when viewed by http, the code is never shown or known to the browser. You can include using full or relative paths on your server, examples:
Code:
/includes/myfile.php |
Thank you guys so much for all the help, everything is working like a charm now! :D
|
Ok i need your help please!
I have created four pages according to this How-To: https://vborg.vbsupport.ru/showthread.php?t=228112 I have also 4 external php scripts that i want to include. I have created 4 templates and 4 plugins. I have change the php_include to php_include_1 to php_include_4 and also changed this accordingly in the templates. Code:
ob_start(); As soon as i activate 2,3 or 4 plugins i get this: Warnung: require_once(../vbtest/test_1.php) [function.require-once]: failed to open stream: No such file or directory in [path]/includes/class_bootstrap.php(122) : eval()'d code (Zeile 7) Fatal error: require_once() [function.require]: Failed opening required '../vbtest/test_1.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/b/b0000009/weball/vbtest/includes/class_bootstrap.php(122) : eval()'d code on line 7 The file which is mentioned as missing here is there and it is producing output as long as i only activate 1 of the modules! I guess it maybe is because of the hook i've chosen? As i was not sure which one, and most of the ones i expected to be the right ones did not work at all i've chosen 'global_bootstrap_init_complete' Any ideas? Which would be the correct hook? Thanks for any help, regards, Matthias |
Where are you wanting the info to show up at? Every page?
|
Ok, i'll explain what i want to achieve, and hopefully you guys can help me.
I'm very new to vBulletin and my knowledge of php is also not 'the' best :) I have a php script that is creating a linklist from files within a directory. At the end of the script i have an echo statement to display the list. What i want is to have this showing up inside a vbulletin page. The only thing i have achieved so far is including this script in the new page i have created according to this: https://vborg.vbsupport.ru/showthread.php?t=228112 I have put PHP Code:
So what i want to achive is: Including the output of several php scripts in several vbulletin pages. www.mysite.com/script1.php > www.mysite.com/page1.php www.mysite.com/script2.php > www.mysite.com/page2.php and so forth. |
Of course you will see the created list if you use echo in the file. You need to use the function from the file to show the listing formatted to whatever template you set up for it.
|
Ok, lack of vbulletin knowledge + only very basic php knowledge = fail :)
I have now changed my script.php file so that the output is now a function. When i include the script.php in a simple php script like this it works. So no problem in the script. PHP Code:
I have a page.php file and a matching template. These i have created after reading this tutorial: https://vborg.vbsupport.ru/showthread.php?t=228112 In the page.php file i include script.php after global.php require_once('./global.php'); require_once('./script.php'); What i still don't understand is where i now have to put "myfunction();" to show the output in a vbulletin page. In the template? In a plugin? Thanks for your help! Really appreciated! Schoelle |
I'm using this and it works, only I want to pass a variable (GLOBALS.foruminfo.title_clean) from my template to my PHP script.
I am attempting to pass the current Forum title and with my own PHP generate CSS to have a specific image for that forum in the background. My Plugin code: Code:
ob_start(); --------------- Added [DATE]1299018239[/DATE] at [TIME]1299018239[/TIME] --------------- figured it out, didnt have to use the global variable - just used foruminfo[title_clean] which worked instead. |
I am using this hack to include a few php pages as it is intended. Everything works great, other than I cannot get form submits to work. I get a "Your submission could not be processed because a security token was missing."
I've looked around on the forum trying to find an answer, but I can't seem to find one. How can I correct this? Thanks. |
Hello,
I'm on 4.1.2 and I used the code mentioned above to vb 4 PHP Code:
PHP Code:
Or is the problem? Thank you |
Can i put a VB variable in that php file such as {vb:raw totalthreads} ? I tried but not sucess
|
Quote:
|
I could also use some help on including php file into a template.
I have a template with an header, a navbar, the forum/content, footer and a fixed right bar. I wan't to insert this php code(for now) into the right bar: userbox.php PHP Code:
PHP Code:
PHP Code:
The HOOK is parse_templates. When i in the plugin write echo $userboxinsert; the userbox get's inserted but at the top of the screen, so the link works. Would be very happy if someone could help me with this problem! |
Total programming n00b here... asking for help :)
I just came here find out how to get a php-script to run, and was really glad to see you guys already had a page on the issue. My idea is fairly simple: I picked up a rotator script (php) and will upload to it's own directory (/rotator). I intend to have several copies (e.g. games.php, religion.php, cars.php, gadgets.php) and each script points to a different sub-directory, e.g. /games, /religion, /cars, /gadgets, etc.) From there, in the last post of every thread I want to call it but will use an IF THEN to dictate which version it calls. (e.g. IF forum=12 then call cars.php, else if forum=15 then call gadgets.php) <vb:if condition="$GLOBALS['forumid'] == 63 OR $GLOBALS['forumid'] == 54 OR $GLOBALS['forumid'] == 56"> [not sure what to put here in order to call 'games.php'] <vb:if> <vb:if condition="$GLOBALS['forumid'] == 3"> [not sure what to put here to call 'cars.php'] <vb:if> This in turn should then reflect relevant files for specific forum content. I suspect the IF THEN will be placed in the template 'ad_thread_last_post_content' (or via the Advertising/Manage Ads script within ACP). I'm uncertain what hook I could use for this (these would only show on SHOWTHREAD templates - or is postbit_legacy as it's only in the last post?). I will later be adding a similar function to the bottom of specific forums to show different rotator scripts (different sized affiliates). Any chance of a bit advice for getting this off the ground? |
When you say "call" do you mean "display"? Is cars.php a page you can view with content if you browse to it?
If so I think what you are looking for is an IFRAME... the basic syntax would be: Code:
<IFRAME SRC="http://domain.com/rotator/cars/cars.php" WIDTH="100%" HEIGHT="50"></IFRAME> You can search google for more options on the IFRAME tag. |
Although an iframe would suffice (thanks, I hadn't even given it a thought), I was under the impression I could an external php file from within a template..?
I'd prefer to do it as a display/call than within an iframe (which would not show to some browsers). In worst case scenario though, i'll go with an iframe. :) |
I just don't know what you mean by "call" a php file then... You can't do that from a template. You could do it from a plugin but again you're not "calling" a file. You can call a function in a file, but if you want to display output from the php file in a specific location you need to make a template for that file.
|
Quote:
Anyway, my idea is to: 1) breakdown forum into separate categories (e.g. religion, cars, games, etc.) 2) in the last post, 'refer to' a specific script. 2a) e.g. religion forum would refer to a script renamed as 'religion.php' 2b) cars forum would refer to a script renamed as 'cars.php' 3) the scripts within each above file would be the same, but refer to different text files. 4) the cars forum & script would then extract data from the text file for cars, which would ultimately show to the end-user as a affiliate image/link specific to cars. 4b) exactly the same as 4) but with religion context instead, so 'christian stuff' would show up in the religion forum (and other religions too). so when a guest comes to my forum and visits the car section, they'll see links and/or images in the final post which will be pertinent to cars... if they swap over to the religion forum (or games or anything else) they will see the last post giving links/images relevant to those forums too. |
What I'm not understanding is why you would make several different php files when you could do the same with a single plugin or really even just template conditionals?
Can you give an example of the HTML code you want displayed from a php file? |
OK, I'm doing it this way because I'm not a PHP guru... I'm doing it in a way I can understand.
So what I've done now is in the 'manage ads' area of the ACP, i've enabled a 'last post only' ad-spot. While testing, it shows only to admins (once it goes live, i'll change this to show only to guests instead). The content of this ad-code is: Code:
<style type="text/css"> I'm sure I could somehow move the /rotate.php file into the parent directory and have it refer to different sub-directories according to what forumID is being viewed... I have no doubt that can be done. But - I don't know how to. So I'm trying to keep things simple for myself. |
Yeah I honestly can't see it getting any better than an IFRAME as you have it without making life A LOT for difficult.
In the unlikely event someone has a browser that doesn't allow IFRAMEs is there some static content you can put between the <IFRAME> and </IFRAME> tags besides "your browser does not support iframes" ? Maybe pick one of the codes you'll be randomizing so it's better than nothing? |
Just wanted to add, as I said previously, I'm not guru where coding is concerned... However, after a quick flick through the vbmanual, I've managed to condense my code using <vb:else if xyz /> statements and an additional <vb:else />. This means, now, it will check to see if viewer is in forum x,y,z and show appropriate php files - otherwise (if not in the above mentioned forums) it will show a google-adsense post instead.
WIN! |
I am planning on getting my entire site converted to take adbantage VB 4. I have more than 50,000 pages, so basically, I cannot use the global_start hook, since I would have hundreds of files / scripts loading on every page. This would not be good...
I thought about using global_start with one product (php master file), and then using conditionals within the script to decide which file to load. But decided to wait until I get some advice on this. One thing I did notice: If you have a php file loaded with global_start, every VB page may or may not use those variables. For example, I created a PHP script that looked for the last 5 forum posts, used a variable called $threadid. It happens to be that $threadid is also used within VB. So the last threadid that was called within my custom script forced VB to use that variable! All links on the forum loaded my own script's variable $threadid. Is this normal behavior? I did change my variable name to something unique, but I'm getting a little paranoid about this, because I may have more than this variable that is also used by VB. This is what I plan... Any feedback would be great. Product Example: ob_start(); include('Masterfile.php'); $masterfile = ob_get_contents(); ob_end_clean(); vB_Template::preRegister('customfiletemplate',arra y('loadexternalscripts' => $masterfile)); ---------------------------------- Masterfile.php Example: PHP Code:
Template: {vb: raw loadexternalscripts} The files would then be loaded like customfilepage.php?file=aboutus and Mod-rewrite would do the trick with bringing basic filenames to the request. |
I'm pretty sure I've heard the global_start hook isn't called on CMS pages anyway. They were going to remove that hook but kept it to keep compatibility with older mods, but didn't add it to the "new" parts of VB4.
I really can't image trying to work on 50,000 pages... good luck with that. But using the same variable names is a concern. Not only should you avoid the variable names used by vBulletin but also names other people have used in mods you have installed. When I make a mod I'll usually call my variables $bop_post or $bop_thread for example to know I'm not changing data used elsewhere. |
Thanks for the info Joe, do you think the method that I plan would work? This way, only one hook is created and loaded, waiting for $_GET instructions to fire off scripts.
|
Quote:
|
I am using VB to include 1 PHP file that is open to requests. These requests load the appropriate files if that's the page being requested. So, this allows a hook to be placed in global_start without actually loading a script and consuming enormous amounts of system resources. The 50,000+ pages are generated from about 10 scripts/programs.
In other words, I am using this script as a hook on global_start with a custom template that has the vb raw variable. This is my PHP code (Master.php). Seems to work very well so far. PHP Code:
PHP Code:
Code:
RewriteRule ^C/([^/]+).php$ /FN/M.php?csl=$1 [QSA,L] Mod-Rewrite generates About-Us.php and you're done. |
Thank you so freakin much!
The file get contents worked! |
I include a file but its showing me this error
Quote:
My file code is PHP Code:
|
I''m not sure where query_read_slave is loaded. Did you try loading the hook in global_start?
|
You should be using $vbulletin->db... to access queries, data, and the like... try this code:
PHP Code:
|
Can I add 2 plugins like this?
--------------- Added [DATE]1332106295[/DATE] at [TIME]1332106295[/TIME] --------------- Nevermind, got it. All you have to do is change bot $php_include variables and the array name to the same thing. |
Thanks it works perfectly, they should update or make more clear the vBulletin manual...
--------------- Added [DATE]1332297428[/DATE] at [TIME]1332297428[/TIME] --------------- Hello Crimm, Thanks very much for your post about including PHP files ... It was much more clear than in the manual. I followed your instructions and everything works fine for the forum, but in the CMS the PHP file is not included. I tried to fix it by adding: PHP Code:
|
Hello,
If would like to use many PHP files on URL can we do something like: PHP Code:
?????????? |
You should be able to do this (use ob_get_clean() instead of ob_get_contents()):
Code:
ob_start(); I think if you want you could also put a preRegister call after each call to ob_get_clean() so you wouldn't need a bunch of different variables. |
I've tried the following code. But whenever you click a user thread, no matter what thread you click, it always brings us to the same thread.
Code:
ob_start(); |
Hello guys,
I finally achieved it!! I did a small tutorial about making External PHP files that can be used as Widgets in vBulletin CMS. I do not know if I can post links here ... but here is the tutorial ... I think someone might find it useful in the future. http://www.hyperlinkbuilding.org/con...idget-Tutorial Greetings, Eddie --------------- Added [DATE]1341004474[/DATE] at [TIME]1341004474[/TIME] --------------- I have to say something else ... Thanks a lot for trying helping me!! I will help others whenever I can. |
I am helping a friend out to try and display his wordpress header above his vb forums header, im using the code below in the plugin and calling it in the header template:
Code:
ob_start(); Code:
Warning: require_once() [function.require-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in [path]/includes/class_bootstrap.php(106) : eval()'d code on line 3 |
All times are GMT. The time now is 07:16 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|