![]() |
|
Article Options |
#31
|
|||
|
|||
o.k. I got that to work, now how to get scripts that call the same page to work?
No members have liked this post.
|
#32
|
|||
|
|||
woooooooooooooooooooooow
very nice thanx thanx man gooood job ![]() exelent No members have liked this post.
|
#33
|
|||
|
|||
How can I php file in my Sidebar include?
help ![]() No members have liked this post.
Last edited by ehsanix; 16 Jan 2011 at 18:13. |
#34
|
||||||||||||
|
||||||||||||
This is a nice tutorial you have, I have read many, but this one is very clear and simple. But from all the tutorials I've tried, I can never get this to work. I want to have a php file output into the postbit_legacy template. So I made a plugin following this tutorial, using this:
Hook Location: global_start Title: Testing Execution Order: 5 And the PHP Code:
Then in the postbit_legacy template I added in {vb:raw php_include} where it should go. Nothing shows up, and I get an error at the top of the page:
I get that error on pages that have posts on it. On the forum homepage, nothing shows up except:
If anyone can help me with this thanks, I have had problems with using plugins to include php files in the templates for too long. It always worked perfectly fine for me in vB 3.4. Thankyou for your time. Note: Where the "****" are, just for posting the code here, I put those in to censor where the files are, just to be safe. I really do have the correct paths in the files uploaded to the site. No members have liked this post.
|
#35
|
||||||||||||||||
|
||||||||||||||||
Well global_start hook location is now obsolete as of 4.0.3+ and 4.1. You should probably use the global_bootstrap_init_start hook instead if you are using a recent version. Also using $php_include as your variable might be causing problems so rename it to something unique. Your plugin code should probably be more like this
and of course the call in the postbit_legacy template {vb:raw creds} The parse error in your code is due to your missing the ";" at the end of your statement
Originally Posted by MMODisneyForums
![]()
No members have liked this post.
Last edited by risestar; 29 Jan 2011 at 04:59. |
#36
|
|||
|
|||
Thanks for the help. I tried all of that, and now every page in the forum is completely blank when I turn the plugin on. If I turn it off the forums are back. Is there any reason for this?
No members have liked this post.
|
#37
|
||||
|
||||
I still don't understand why you guys just don't use the require_once to include the file in the php hook right before the code you want to use it with. You are taking the long way around doing it this way. Unless you need the included file for every page, it makes no sense to put it in the global hook.
No members have liked this post.
|
#38
|
||||
|
||||
What version of vbulletin are you using?
If you type in the script location directly from your browser, does it work? If not, then its a problem with your script. Also, your php.ini might be set to disallow http php include calls, if you so need to enable it, or use the path call instead
Otherwise, its a typo, if you are using this code, make sure you cut and paste it, have the path/url correct No members have liked this post.
|
#39
|
|||
|
|||
I'm using version 4.1.0. I tried changing my creds.php file to just simply echo "Test", and I still just get a plain white page on the forums. If I open the php file in my browser it correctly says Test. Should I change the hook location? Is there a better location for postbit_legacy? And I have copy pasted that code exactly in, and replaced the URL. What could be going wrong here? Thanks
Edit: I have noticed something else that is interesting. If I remove the {vb:raw creds} from the postbit_legacy template, there is still a blank page. If the plugin is on, theres a blank page, even if its not being called from the template. Hope this helps. No members have liked this post.
|
#40
|
|||
|
|||
The plugin is fairly straight forward, as long as you have a valid script that you are calling and your plugin code is valid, you should be good to go.
you might have a php.ini config issue going on. Create a new file in your forum root, call it test.php Insert this <?php include ("/server/path/to/your/test.php"); ?> <?php include ("http://www.yoursite.com/forum/test.php"); ?> /insert this Then open the test.php in your browser If they BOTH work, you should have your echoed text inserted twice. If only ONE works, or you get a php error, you have a php.ini config issue to work out. No members have liked this post.
|
#41
|
|||
|
|||
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. No members have liked this post.
Last edited by MMODisneyForums; 02 Feb 2011 at 08:15. |
#42
|
|||
|
|||
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 No members have liked this post.
Last edited by risestar; 02 Feb 2011 at 21:16. |
#43
|
||||
|
||||
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:
__________________
-Joe Former vb.org Moderator. Retired. @BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic Note - I no longer making new VB mods, sorry. No members have liked this post.
|
#44
|
|||
|
|||
Thank you guys so much for all the help, everything is working like a charm now!
![]() No members have liked this post.
|
#45
|
||||
|
||||
Ok i need your help please!
I have created four pages according to this How-To: http://www.vbulletin.org/forum/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.
It works als long as i only activate 1 of those 4 plugins. 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 No members have liked this post.
Last edited by Schoelle; 14 Feb 2011 at 09:43. |
![]() |
«
Previous Article
|
Next Article
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Article Options | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 00:36.