• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with including a file in codeigniter folder from root

#1
[eluser]hartmannr76[/eluser]
Hey everyone,
I just started working with CodeIgniter today and the biggest reason I chose it was because of the community.. Ok, I apologize if its a newb question but I'm relatively new to PHP and brand spanking new to CodeIgniter so this is what I have..

In the root directory of my website I have my index.php file, and in the file I'm trying to call a controller that is in the ci/application/controllers folder on my root.

If I just put the whole "sitename.com/ci/index.php/site/myFunction" in the URL bar, I'm getting what I'm looking to see, but when I try to include in my index.php (my homepage) I
'm getting a "include(blah blah):failed to open stream: Not a directory in /home/user/public_html/index.php" error.

My include is set as: include("ci/index.php/site/");

Is there a way to get this to display?

Thanks!

#2
[eluser]InsiteFX[/eluser]
You do not include that in index.php, index.php loads the defaulr controller set in application/config/routes.php

That's the controller that index.php will run.

InsiteFX

#3
[eluser]hartmannr76[/eluser]
Ok I think I understand that.. than what should I have as my include to call that controllers function?

#4
[eluser]hartmannr76[/eluser]
Maybe ill explain a little more..

As a representation in a tree format:

These are files and folders in my root ((f) will represent a folder):
(f)ci
->(f)application
->(f)controllers
->site.php (this has a method that im trying to call outside of the ci folder)
(f)images
(f)css
-index.php (this is where i call the include(/ci/site.php))

I mean since its not working I know there is something wrong but Im just not sure if im missing something I need to add in or whatnot.. does this help a little more explaining?

#5
[eluser]InsiteFX[/eluser]
edit the application/config/routes.php

If site is your default controller then put that in the routes.php default controller

InsiteFX

#6
[eluser]hartmannr76[/eluser]
Thanks for your help by the way..

I still dont have it working, I changed the routes.php and changed my include to include("/ci/");
but now its says :
Failed opening '/ci/' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/index.php

#7
[eluser]InsiteFX[/eluser]
Take the include out you do not need it!

InsiteFX

#8
[eluser]hartmannr76[/eluser]
but the index.php i have that is trying to reference that function is not in the ci folder.. how else would i reference that?

#9
[eluser]InsiteFX[/eluser]
Then explain what your trying to do! It sounds like your not even using the CodeIgniter index.php

CodeIgniters index.php runs everything in CodeIgniter.

InsiteFX

#10
[eluser]hartmannr76[/eluser]
Ok, I plan on using codeigniter for a blog, so in my root for my site I have the following files and folders
(f)ci (this is my codeigniter folder)
(f)images
(f)css
-index.php (this is the main page of my site)

Im trying to have my main site read in a feed from my codeigniter blog, so my index.php that I keep referencing is not in, nor is associated with the codeigniter index.php.. two completely different things
in my ci folder, I have my controller to display exactly what i want to display on my main site as my feed.. how do I (if its possible) get that controller I made in the codeigniter folder to be displayed on my main site.. I was under the impression it was an include call

Did this help a little bit?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.