$this->load->file that i want??[SOLVED] |
[eluser]Ngulo[/eluser]
ahahah sorry man ,maybe i will result really banal i'm wonder is possible to have something like this in Codeigniter? Code: $this->load->my_folder('my_file'); thanks
[eluser]Starovich[/eluser]
[quote author="ispuk" date="1270182676"]ahahah sorry man ,maybe i will result really banal i'm wonder is possible to have something like this in Codeigniter? Code: $this->load->my_folder('my_file'); thanks [/quote] Well, not exactly like that, but you could write a library that gets the content of a file and then call Code: $data['my_file'] = $this->my_file_getter_library->load_file("/folder/filename.txt");
[eluser]flaky[/eluser]
you can load a file with codeigniter Code: $this->load->file('filepath/filename', true/false); read the user guide
[eluser]Ngulo[/eluser]
thank you guys, your solutions are pretty amazing!!!! flaky's solution seems to be all that i was looking for flaky do you know,must i specify the file extension ? can i do this for example: Code: $this->load->file('css/style.css',true/false) instead of: Code: <link type="text/css" rel="stylesheet" href="css/style.css" media="screen" /> it's the same way of including css stylesheets? thanks again!!!
[eluser]flaky[/eluser]
if you want to store the text/data from the file to a variable do this Code: $this->load->file('css/style.css',true); $this->load->file() is only for getting the contents of a file not for creating html content cheers
[eluser]Starovich[/eluser]
[quote author="flaky" date="1270208844"]you can load a file with codeigniter Code: $this->load->file('filepath/filename', true/false); read the user guide[/quote] That's really handy, thanks for the tip!
[eluser]Ngulo[/eluser]
guys only another one question if i load the file without using any of True/False ,are there any problems? it seems to work also without True/False statment ....but i'm wondering why,just for understanding thanks again
[eluser]PĂ©turV[/eluser]
[quote author="ispuk" date="1270256168"]guys only another one question if i load the file without using any of True/False ,are there any problems? it seems to work also without True/False statment ....but i'm wondering why,just for understanding thanks again[/quote] http://ellislab.com/codeigniter/user-gui...oader.html This is a generic file loading function. Supply the filepath and name in the first parameter and it will open and read the file. By default the data is sent to your browser, just like a View file, but if you set the second parameter to true (boolean) it will instead return the data as a string.
[eluser]Ngulo[/eluser]
thanks but i do not understand at all....if i don't specify any False or True parameter ,it will be included only? this: $this->load->file('path_to_file'); is the same as: include('path_to_file'); ?? thanks again |
Welcome Guest, Not a member yet? Register Sign In |