CodeIgniter Forums
php include with CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: php include with CI (/showthread.php?tid=8625)



php include with CI - El Forum - 05-24-2008

[eluser]defrey74[/eluser]
Hi,

How do i use a php include within CI?

Thanks

Fred


php include with CI - El Forum - 05-24-2008

[eluser]bradym[/eluser]
Code:
include('file.php');
Same as usual. If there something specific you're trying to do, give some details and we can help better. Smile


php include with CI - El Forum - 05-24-2008

[eluser]defrey74[/eluser]
Here is what i am trying to do?

In a normal php app i will use the following:
<?php include('lib/file.php'); ?>

I just want to be able to do the same in CI:
Might look like something like this:

<?=base_url()?>lib/file.php>
My question is Where do i put the include?

Thanks

Fred


php include with CI - El Forum - 05-24-2008

[eluser]bradym[/eluser]
Depends on what the include file is for. At work we've got a standard tracking script we use on all of our sites, and it contains functionality that needs to work everywhere on the site, so I put the include as the first line of index.php. Since every page request on a CI site goes through index.php, this works well.

If it's code that you need in one specific location in the code, ie: controller, model, etc, then include it there.


php include with CI - El Forum - 05-24-2008

[eluser]defrey74[/eluser]
Thanks