-
christaliise Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 194
Threads: 29
Joined: Jul 2015
Reputation:
-5
I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”.
But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.)
public function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
-
Dracula CodeIgniter Contributor
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 57
Threads: 4
Joined: Nov 2014
Reputation:
2
07-08-2015, 12:50 PM
(This post was last modified: 07-08-2015, 12:51 PM by Dracula.)
(07-08-2015, 09:55 AM)christaliise Wrote: I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”.
But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.)
public function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
You have to create a controller in application/controllers directory.
For example, create the file Pages.php in the above directory and paste in this code:
PHP Code: <?php
class Pages extends CI_Controller {
public function__construct() { }
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); }
}
After this, you have to go to application/config/routes.php to set up the default controller.
It should look like this:
PHP Code: $route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1';
-
christaliise Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 194
Threads: 29
Joined: Jul 2015
Reputation:
-5
(07-08-2015, 12:50 PM)Dracula Wrote: (07-08-2015, 09:55 AM)christaliise Wrote: I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”.
But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.)
public function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
You have to create a controller in application/controllers directory.
For example, create the file Pages.php in the above directory and paste in this code:
PHP Code: <?php
class Pages extends CI_Controller {
public function__construct() { }
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); }
}
After this, you have to go to application/config/routes.php to set up the default controller.
It should look like this:
PHP Code: $route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1';
Thanks Dracula, I had added the code to Pages.php but not in the same form as you indicated, however I've now changed it. Is there some reason for the code that you submitted being different by including - public function__construct() - than the code in the Tutorial and a reason why the coding you submitted not being in the box below this line "Create a file at application/controllers/Pages.php with the following code."?
I had also added the code to routes.php but I'm confused with "Remove all other code that sets any element in the $route array." I don't know what code will set an element in the $route array, but I guessed that this line - $route['default_controller'] = 'welcome'; - should be deleted, and the 2 added lines inserted to above $route['404_override'] = '';.
In any event I still get the XAMPP "Welcome Page" coming up in my browser, despite my numerous and varying attempts. The URL keeps reverting to http://localhost/xampp/
-
Dracula CodeIgniter Contributor
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 57
Threads: 4
Joined: Nov 2014
Reputation:
2
(07-09-2015, 02:27 AM)christaliise Wrote: (07-08-2015, 12:50 PM)Dracula Wrote: (07-08-2015, 09:55 AM)christaliise Wrote: I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”.
But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.)
public function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
You have to create a controller in application/controllers directory.
For example, create the file Pages.php in the above directory and paste in this code:
PHP Code: <?php
class Pages extends CI_Controller {
public function__construct() { }
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); }
}
After this, you have to go to application/config/routes.php to set up the default controller.
It should look like this:
PHP Code: $route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1';
Thanks Dracula, I had added the code to Pages.php but not in the same form as you indicated, however I've now changed it. Is there some reason for the code that you submitted being different by including - public function__construct() - than the code in the Tutorial and a reason why the coding you submitted not being in the box below this line "Create a file at application/controllers/Pages.php with the following code."?
I had also added the code to routes.php but I'm confused with "Remove all other code that sets any element in the $route array." I don't know what code will set an element in the $route array, but I guessed that this line - $route['default_controller'] = 'welcome'; - should be deleted, and the 2 added lines inserted to above $route['404_override'] = '';.
In any event I still get the XAMPP "Welcome Page" coming up in my browser, despite my numerous and varying attempts. The URL keeps reverting to http://localhost/xampp/
Hi there,
First, the method __construct is not always required but it is better that you create it in your controllers.
Mabe you whant to load some models in your controller and this is the place you do it.
For the routes.php file.
The $route['default_controler'] requires a controller name that will be accesed by default when you go to www.yourtsitename.com
For the XAMPP problem, you must create a separete folder in your xampp httdocs for your project, codeigniter, and then paste all the codeigniter files and directories there, after that you can acces it from going to localhost/yourproject
-
christaliise Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 194
Threads: 29
Joined: Jul 2015
Reputation:
-5
(07-09-2015, 02:45 AM)Dracula Wrote: (07-09-2015, 02:27 AM)christaliise Wrote: (07-08-2015, 12:50 PM)Dracula Wrote: (07-08-2015, 09:55 AM)christaliise Wrote: I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”.
But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.)
public function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
You have to create a controller in application/controllers directory.
For example, create the file Pages.php in the above directory and paste in this code:
PHP Code: <?php
class Pages extends CI_Controller {
public function__construct() { }
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); }
}
After this, you have to go to application/config/routes.php to set up the default controller.
It should look like this:
PHP Code: $route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1';
Thanks Dracula, I had added the code to Pages.php but not in the same form as you indicated, however I've now changed it. Is there some reason for the code that you submitted being different by including - public function__construct() - than the code in the Tutorial and a reason why the coding you submitted not being in the box below this line "Create a file at application/controllers/Pages.php with the following code."?
I had also added the code to routes.php but I'm confused with "Remove all other code that sets any element in the $route array." I don't know what code will set an element in the $route array, but I guessed that this line - $route['default_controller'] = 'welcome'; - should be deleted, and the 2 added lines inserted to above $route['404_override'] = '';.
In any event I still get the XAMPP "Welcome Page" coming up in my browser, despite my numerous and varying attempts. The URL keeps reverting to http://localhost/xampp/
Hi there,
First, the method __construct is not always required but it is better that you create it in your controllers.
Mabe you whant to load some models in your controller and this is the place you do it.
For the routes.php file.
The $route['default_controler'] requires a controller name that will be accesed by default when you go to www.yourtsitename.com
For the XAMPP problem, you must create a separete folder in your xampp httdocs for your project, codeigniter, and then paste all the codeigniter files and directories there, after that you can acces it from going to localhost/yourproject
Thanks Dracula. Yes, I had created a separate folder for my project and pasted the CodeIgniter files there, but I'm thinking my problem maybe the config link not being changed e.g. $config['base_url'] = ''; or some other setting. I have tried inserting the project name in $config but still get the XAMPP "Welcome Page" coming up in my browser. Does some setting like that need to be changed?
-
Dracula CodeIgniter Contributor
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 57
Threads: 4
Joined: Nov 2014
Reputation:
2
(07-09-2015, 09:35 AM)christaliise Wrote: (07-09-2015, 02:45 AM)Dracula Wrote: (07-09-2015, 02:27 AM)christaliise Wrote: (07-08-2015, 12:50 PM)Dracula Wrote: (07-08-2015, 09:55 AM)christaliise Wrote: I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”.
But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.)
public function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
You have to create a controller in application/controllers directory.
For example, create the file Pages.php in the above directory and paste in this code:
PHP Code: <?php
class Pages extends CI_Controller {
public function__construct() { }
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); }
}
After this, you have to go to application/config/routes.php to set up the default controller.
It should look like this:
PHP Code: $route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1';
Thanks Dracula, I had added the code to Pages.php but not in the same form as you indicated, however I've now changed it. Is there some reason for the code that you submitted being different by including - public function__construct() - than the code in the Tutorial and a reason why the coding you submitted not being in the box below this line "Create a file at application/controllers/Pages.php with the following code."?
I had also added the code to routes.php but I'm confused with "Remove all other code that sets any element in the $route array." I don't know what code will set an element in the $route array, but I guessed that this line - $route['default_controller'] = 'welcome'; - should be deleted, and the 2 added lines inserted to above $route['404_override'] = '';.
In any event I still get the XAMPP "Welcome Page" coming up in my browser, despite my numerous and varying attempts. The URL keeps reverting to http://localhost/xampp/
Hi there,
First, the method __construct is not always required but it is better that you create it in your controllers.
Mabe you whant to load some models in your controller and this is the place you do it.
For the routes.php file.
The $route['default_controler'] requires a controller name that will be accesed by default when you go to www.yourtsitename.com
For the XAMPP problem, you must create a separete folder in your xampp httdocs for your project, codeigniter, and then paste all the codeigniter files and directories there, after that you can acces it from going to localhost/yourproject
Thanks Dracula. Yes, I had created a separate folder for my project and pasted the CodeIgniter files there, but I'm thinking my problem maybe the config link not being changed e.g. $config['base_url'] = ''; or some other setting. I have tried inserting the project name in $config but still get the XAMPP "Welcome Page" coming up in my browser. Does some setting like that need to be changed?
You don't have to set base_url.
Do you have an .htaccess file in the root of your project?
If not, create one and paste this in:
Code: <IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
-
christaliise Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 194
Threads: 29
Joined: Jul 2015
Reputation:
-5
07-09-2015, 06:31 PM
(This post was last modified: 07-13-2015, 07:03 PM by christaliise.)
(07-09-2015, 09:46 AM)Dracula Wrote: (07-09-2015, 09:35 AM)christaliise Wrote: (07-09-2015, 02:45 AM)Dracula Wrote: (07-09-2015, 02:27 AM)christaliise Wrote: (07-08-2015, 12:50 PM)Dracula Wrote: You have to create a controller in application/controllers directory.
For example, create the file Pages.php in the above directory and paste in this code:
PHP Code: <?php
class Pages extends CI_Controller {
public function__construct() { }
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); }
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); }
}
After this, you have to go to application/config/routes.php to set up the default controller.
It should look like this:
PHP Code: $route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1';
Thanks Dracula, I had added the code to Pages.php but not in the same form as you indicated, however I've now changed it. Is there some reason for the code that you submitted being different by including - public function__construct() - than the code in the Tutorial and a reason why the coding you submitted not being in the box below this line "Create a file at application/controllers/Pages.php with the following code."?
I had also added the code to routes.php but I'm confused with "Remove all other code that sets any element in the $route array." I don't know what code will set an element in the $route array, but I guessed that this line - $route['default_controller'] = 'welcome'; - should be deleted, and the 2 added lines inserted to above $route['404_override'] = '';.
In any event I still get the XAMPP "Welcome Page" coming up in my browser, despite my numerous and varying attempts. The URL keeps reverting to http://localhost/xampp/
Hi there,
First, the method __construct is not always required but it is better that you create it in your controllers.
Mabe you whant to load some models in your controller and this is the place you do it.
For the routes.php file.
The $route['default_controler'] requires a controller name that will be accesed by default when you go to www.yourtsitename.com
For the XAMPP problem, you must create a separete folder in your xampp httdocs for your project, codeigniter, and then paste all the codeigniter files and directories there, after that you can acces it from going to localhost/yourproject
Thanks Dracula. Yes, I had created a separate folder for my project and pasted the CodeIgniter files there, but I'm thinking my problem maybe the config link not being changed e.g. $config['base_url'] = ''; or some other setting. I have tried inserting the project name in $config but still get the XAMPP "Welcome Page" coming up in my browser. Does some setting like that need to be changed?
You don't have to set base_url.
Do you have an .htaccess file in the root of your project?
If not, create one and paste this in:
Code: <IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I don't know where or what is the "root" but I found one at - application/.htaccess
And I replaced it with the content you provided, but still get the XAMPP "Welcome Page" coming up in my browser.
There is another at - system/.htaccess - but I have not tried to replace the contents.
**********
Dracula, can you please explain where I should find the "root" and if not found, where to create .htaccess file?
**********
This is the URL I'm using;
http://localhost/MyProject/index.php/pages/view
I have created a .htaccess file in
C:/xampp/htdocs/MyProject/.htaccess
and in
C:/xampp/htdocs/.htaccess
but now I have deleted it.
If I include
public function__construct()
{
}
in Pages.php I get the following result;
Parse error: syntax error, unexpected 'function__construct' (T_STRING), expecting variable (T_VARIABLE) in C:\xampp\htdocs\MyProject\application\controllers\Pages.php on line 4
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected 'function__construct' (T_STRING), expecting variable (T_VARIABLE)
Filename: controllers/Pages.php
Line Number: 4
Backtrace:
***********
If I delete
public function__construct()
{
}
from Pages.php I get the following result;
Home
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter $this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); } “Hello World!”© 2014
Can somebody explain where I'm going wrong?
***********
I note in the News Section that there is a space between the "n" and "__"
public function __construct()
and don't know which is correct.
***********
14/07/2015
I would like to know what is causing the following error;
Home
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter $this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); } “Hello World!”© 2014
Can anybody help?
-
christaliise Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
-
Posts: 194
Threads: 29
Joined: Jul 2015
Reputation:
-5
(07-09-2015, 06:31 PM)christaliise Wrote: (07-09-2015, 09:46 AM)Dracula Wrote: (07-09-2015, 09:35 AM)christaliise Wrote: (07-09-2015, 02:45 AM)Dracula Wrote: (07-09-2015, 02:27 AM)christaliise Wrote: Thanks Dracula, I had added the code to Pages.php but not in the same form as you indicated, however I've now changed it. Is there some reason for the code that you submitted being different by including - public function__construct() - than the code in the Tutorial and a reason why the coding you submitted not being in the box below this line "Create a file at application/controllers/Pages.php with the following code."?
I had also added the code to routes.php but I'm confused with "Remove all other code that sets any element in the $route array." I don't know what code will set an element in the $route array, but I guessed that this line - $route['default_controller'] = 'welcome'; - should be deleted, and the 2 added lines inserted to above $route['404_override'] = '';.
In any event I still get the XAMPP "Welcome Page" coming up in my browser, despite my numerous and varying attempts. The URL keeps reverting to http://localhost/xampp/
Hi there,
First, the method __construct is not always required but it is better that you create it in your controllers.
Mabe you whant to load some models in your controller and this is the place you do it.
For the routes.php file.
The $route['default_controler'] requires a controller name that will be accesed by default when you go to www.yourtsitename.com
For the XAMPP problem, you must create a separete folder in your xampp httdocs for your project, codeigniter, and then paste all the codeigniter files and directories there, after that you can acces it from going to localhost/yourproject
Thanks Dracula. Yes, I had created a separate folder for my project and pasted the CodeIgniter files there, but I'm thinking my problem maybe the config link not being changed e.g. $config['base_url'] = ''; or some other setting. I have tried inserting the project name in $config but still get the XAMPP "Welcome Page" coming up in my browser. Does some setting like that need to be changed?
You don't have to set base_url.
Do you have an .htaccess file in the root of your project?
If not, create one and paste this in:
Code: <IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I don't know where or what is the "root" but I found one at - application/.htaccess
And I replaced it with the content you provided, but still get the XAMPP "Welcome Page" coming up in my browser.
There is another at - system/.htaccess - but I have not tried to replace the contents.
**********
Dracula, can you please explain where I should find the "root" and if not found, where to create .htaccess file?
**********
This is the URL I'm using;
http://localhost/MyProject/index.php/pages/view
I have created a .htaccess file in
C:/xampp/htdocs/MyProject/.htaccess
and in
C:/xampp/htdocs/.htaccess
but now I have deleted it.
If I include
public function__construct()
{
}
in Pages.php I get the following result;
Parse error: syntax error, unexpected 'function__construct' (T_STRING), expecting variable (T_VARIABLE) in C:\xampp\htdocs\MyProject\application\controllers\Pages.php on line 4
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected 'function__construct' (T_STRING), expecting variable (T_VARIABLE)
Filename: controllers/Pages.php
Line Number: 4
Backtrace:
***********
If I delete
public function__construct()
{
}
from Pages.php I get the following result;
Home
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter $this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); } “Hello World!”© 2014
Can somebody explain where I'm going wrong?
***********
I note in the News Section that there is a space between the "n" and "__"
public function __construct()
and don't know which is correct.
***********
14/07/2015
I would like to know what is causing the following error;
Home
public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter $this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); } “Hello World!”© 2014
Can anybody help? After many hours of searching I found the cause of a majority of the problem. The data from the word "public" to "$data); }" was pasted in my home.php and about.php pages. While I can't rule out that I pasted and saved that data in those 2 files, I do suspect the system placed them there so if anybody else is having similar problems look in those files first.
But there is no "header" and the "footer" contents are on the same line as "page" content.
|