Can't include a file in my view! |
[eluser]markanderson993[/eluser]
Hello there CodeIgniter experts! I hope my question is simple! Why can't I include an external file in my view?! Here is what I'm doing... Code: <?php include("..../cgi-bin/filechucker.cgi?userdir=" . $this->vbuser->fetch_info('username') ."&suid;=".$this->vbuser->fetch_info('userid'). "&".$_SERVER['QUERY_STRING']); ?> I keep getting the same message though! Quote:A PHP Error was encountered Does anybody know why?!!! Your help is greatly appreciated!!!
[eluser]Spockz[/eluser]
what does '..../' mean? Go down up two directories? (That would be '../../')
[eluser]markanderson993[/eluser]
Thank you Spockz for your speedy reply ![]() Code: <?php include("../../cgi-bin/filechucker.cgi?userdir=" . $this->vbuser->fetch_info('username') ."&suid;=".$this->vbuser->fetch_info('userid'). "&".$_SERVER['QUERY_STRING']); ?> ![]() It seems that whatever I do, I can't ever reach the cgi-bin directory. My website structure is as follows: - Root - index.php - cgi-bin (folder) - system ... - views - upload (folder) - upload_view.php (the file in use) It seems that no matter what I do I can never access the cgi-bin from there. This is so frustrating!
[eluser]Spockz[/eluser]
You need to go up three levels in that schema before you can reach the cgi-bin. ![]() Code: include dirname(__FILE__).'/../../../cgi-bin.etc..';
[eluser]markanderson993[/eluser]
This is proving to be very difficult! I tried your suggestion but I was still given an error Quote:Message: include(/home/scorebee/mysite.com.com/system/application/views/uploader/../../../cgi-bin/filechucker.cgi?userdir=anderma&suid=1&uploader This is the code I used: Code: <?php include dirname(__FILE__)."/../../../cgi-bin/filechucker.cgi?userdir=" . $this->vbuser->fetch_info('username') ."&suid;=".$this->vbuser->fetch_info('userid'). "&".$_SERVER['QUERY_STRING']; ?> Line Number: 9
[eluser]Michael Wales[/eluser]
Many... that's getting ugly - maybe wrap it in realpath() so you know you are getting an absolute path name (rather than a relative from the current directory).
[eluser]Spockz[/eluser]
Ah, that's a different structure than mentioned in your tree. I think your tree should look like Code: 4-Root So you need to go 4 times up. Maybe it's easier to do something like: Code: include BASEPATH.'/../cgi-bin.etc...'; It isn't relative so you can use it anywere. And it might even by handier if you'd define this in your index.php Code: define('CGIPATH', dirname(__FILE__).'/cgi-bin');
[eluser]markanderson993[/eluser]
Thanks for all your input so far, it's been very helpful. I believe my structure tree is identical to yours (if you mean to have index, cgi-bin, and system all in the same folder). I liked your idea of including a CGI constant variable and I added that to the index.php page I also changed the include path in my upload_view.php to Code: <?php include CGIPATH. "/filechucker.cgi?userdir=" . $this->vbuser->fetch_info('username') ."&suid;=".$this->vbuser->fetch_info('userid'). "&".$_SERVER['QUERY_STRING']; ?> However I was still given an error. Quote:A PHP Error was encountered It seems like it won't even accept an absolute URL. What is going on!?!?!?! I'm getting really really frustrated! Again, thanks so much for your help so far! Note: I hope this gives you some understanding of the situation, when I copy and paste the .../cgi-bin/... URL from the error into the browser I receive the actual page. But when I try and access it through an include in the upload_view.php I always receive an error. Perhaps the folder is not properly chmodded? - Pianoman933
[eluser]Spockz[/eluser]
What's the error? Do those files really exist? Oh wait a second. Get rid of the ?.. part. You are including a file and not requesting it through the http side of apache. ![]()
[eluser]markanderson993[/eluser]
Thank you I was able to get a bit of progress! Isn't there ANY way I can pass $_GET variables into the CGI script though? |
Welcome Guest, Not a member yet? Register Sign In |