Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #31  
Old 02 Jan 2011, 17:45
robert garrett robert garrett is offline
 
Join Date: Mar 2010
o.k. I got that to work, now how to get scripts that call the same page to work?
Reply With Quote
  #32  
Old 14 Jan 2011, 21:17
ehsanix ehsanix is offline
 
Join Date: Oct 2003
woooooooooooooooooooooow
very nice
thanx
thanx man
gooood job
exelent
Reply With Quote
  #33  
Old 16 Jan 2011, 00:58
ehsanix ehsanix is offline
 
Join Date: Oct 2003
How can I php file in my Sidebar include?
help

Last edited by ehsanix; 16 Jan 2011 at 18:13.
Reply With Quote
  #34  
Old 27 Jan 2011, 03:47
MMODisneyForums MMODisneyForums is offline
 
Join Date: Jan 2011
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:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I get that error on pages that have posts on it. On the forum homepage, nothing shows up except:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #35  
Old 29 Jan 2011, 04:52
risestar risestar is offline
 
Join Date: Nov 2001
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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


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 View Post
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:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I get that error on pages that have posts on it. On the forum homepage, nothing shows up except:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Last edited by risestar; 29 Jan 2011 at 04:59.
Reply With Quote
  #36  
Old 31 Jan 2011, 19:54
MMODisneyForums MMODisneyForums is offline
 
Join Date: Jan 2011
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?
Reply With Quote
  #37  
Old 31 Jan 2011, 20:46
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
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.
Reply With Quote
  #38  
Old 31 Jan 2011, 21:36
risestar risestar is offline
 
Join Date: Nov 2001
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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Otherwise, its a typo, if you are using this code, make sure you cut and paste it, have the path/url correct



Originally Posted by MMODisneyForums View Post
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?
Reply With Quote
  #39  
Old 31 Jan 2011, 22:31
MMODisneyForums MMODisneyForums is offline
 
Join Date: Jan 2011
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.
Reply With Quote
  #40  
Old 02 Feb 2011, 04:48
risestar risestar is offline
 
Join Date: Nov 2001
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.
Reply With Quote
  #41  
Old 02 Feb 2011, 05:22
MMODisneyForums MMODisneyForums is offline
 
Join Date: Jan 2011
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.

Last edited by MMODisneyForums; 02 Feb 2011 at 08:15.
Reply With Quote
  #42  
Old 02 Feb 2011, 21:06
risestar risestar is offline
 
Join Date: Nov 2001
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

Last edited by risestar; 02 Feb 2011 at 21:16.
Reply With Quote
  #43  
Old 02 Feb 2011, 21:57
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #44  
Old 04 Feb 2011, 06:25
MMODisneyForums MMODisneyForums is offline
 
Join Date: Jan 2011
Thank you guys so much for all the help, everything is working like a charm now!
Reply With Quote
  #45  
Old 08 Feb 2011, 21:46
Schoelle Schoelle is offline
 
Join Date: Feb 2011
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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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

Last edited by Schoelle; 14 Feb 2011 at 09:43.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 21:12.

Layout Options | Width: Wide Color: