Welcome Guest, Not a member yet? Register   Sign In
include() ?
#1

[eluser]trevor2[/eluser]
I'm new to CI, php and programming in general. How do I properly include other php files, such as a functions.php? Or are they supposed to be placed in the model thing?

My config file has : $config['base_url'] = "http://localhost/";
The include file I would normally call by this: <?php include("functions_test.php"); ?>
I also tried: <?php include(base_url("functions_test.php")); ?>
Which gives these errors:

********************************************************************
A PHP Error was encountered

Severity: Warning

Message: include() [function.include]: URL file-access is disabled in the server configuration

Filename: views/blogview.php

Line Number: 7
A PHP Error was encountered

Severity: Warning

Message: include(http://localhost/) [function.include]: failed to open stream: no suitable wrapper could be found

Filename: views/blogview.php

Line Number: 7
A PHP Error was encountered

Severity: Warning

Message: include() [function.include]: Failed opening 'http://localhost/' for inclusion (include_path='.;C:\xampp\php\pear\')

Filename: views/blogview.php

Line Number: 7
**********************************************************************************
#2

[eluser]johnwbaxter[/eluser]
You can turn them into libraries or helpers if you like. Then load them like err.. libraries or helpers Wink

http://ellislab.com/codeigniter/user-gui...aries.html




Theme © iAndrew 2016 - Forum software by © MyBB