December 29, 2011

How to include a file in Codeigniter?

Question by joomlearner

I have an xml file, inside views folder and I want read it, before I load the view.
for example

views 
    default/
         info.xml

How to do this?

Answer by Starx

Very Simple. Load the file using this

$xmlData = $this -> load -> file("application/views/default/info.xml", true);

Now use the data, where needed.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!