Welcome Guest, Not a member yet? Register   Sign In
php include with CI
#1

[eluser]defrey74[/eluser]
Hi,

How do i use a php include within CI?

Thanks

Fred
#2

[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
#3

[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
#4

[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.
#5

[eluser]defrey74[/eluser]
Thanks




Theme © iAndrew 2016 - Forum software by © MyBB