• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loading a view vs. loading a file

#1
[eluser]neomech[/eluser]
Hi,

I'm trying to work with an xml file that I created. I was using simplexml_load_file (I've got PHP 5 installed) and was getting an error so I thought I'd use the CI load library functions.

If I try this in my controller:
Code:
xml=$this->load->file('../xml/filter.xml',TRUE);
I get an error: "Unable to load the requested file: filter.xml"

If I try this instead:
Code:
$xml=$this->load->view('../xml/filter.xml','',TRUE);
Everything seems to work.

Can anyone explain why either the simplexml call or the CI load->file call aren't working? It seems like the other two methods are looking for me to identify the directory differently.

If it matters, my directory structure is:

-application
--model
--view
--controller
--xml
-library
--system
-public_html
--images
--js
--css

I'm using the .htaccess file from the CI wiki (Elliot Haughin's)

#2
[eluser]richthegeek[/eluser]
load->file goes from the root directory (which contains system, user_guide, index.php etc) whilst load->view goes from application/views.

#3
[eluser]neomech[/eluser]
Ahh....awesome...everything works now. Thanks very much!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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