php - codeigniter include common file in view -
hi have site developed in codeigniter , wanto store file called common.php javascript/php function use in many pages. have tried in mode:
require(base_url().'application/libraries/common.php'); //i have tried include
this return me error:
a php error encountered severity: warning message: require() [function.require]: http:// wrapper disabled in server configuration allow_url_include=0
i'm going php.ini , turn on allow_url_include, restart apache , when try load page return me error:
a php error encountered severity: warning message: require() [function.require]: http:// wrapper disabled in server configuration allow_url_include=0 filename: backend/hotel_view.php line number: 6 php error encountered severity: warning message: require(http://demo.webanddesign.it/public/klikkahotel.com/application/libraries/common.php) [function.require]: failed open stream: no suitable wrapper found filename: backend/hotel_view.php line number: 6 fatal error: require() [function.require]: failed opening required 'http://demo.webanddesign.it/public/klikkahotel.com/application/libraries/common.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/public/klikkahotel.com/application/views/backend/hotel_view.php on line 6
what can include simple file pages?
pull whichever views want using $this->load->view('common');
can include other views either controller or view.
example 1
your_controller.php
public function index() { $this->load->view('homepage'); }
views/homepage.php
<?php $this->load->view('common'); ?> <body> <!-- html --> </body>
example 2
your_controller.php
public function index() { $this->load->view('common'); $this->load->view('homepage'); }
Comments
Post a Comment