CodeIgniter Forums
Noob working through tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Noob working through tutorial (/showthread.php?tid=64574)

Pages: 1 2


Noob working through tutorial - muckydog - 03-06-2016

Brand spanking new to CI and have followed the install and initial tutorial instructions step by step. Does not work according to plan on my localhost. Thought it might be something wrong with my local setup, so tried on remote web server with same issues.

After installation, the index.php page shows as expected: http://www.geopd.org/membership/index.php

After following Static Pages tutorial, I get this: http://www.geopd.org/membership/index.php/pages/view/

Any helpful suggestions for where to look for solutions much appreciated!


RE: Noob working through tutorial - albertleao - 03-06-2016

Can you post the code for the function you are running?


RE: Noob working through tutorial - muckydog - 03-06-2016

(03-06-2016, 01:13 PM)albertleao Wrote: Can you post the code for the function you are running?

application/controllers/Pages.php

<? php
class Pages extends CI_Controller {

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);
}

}


RE: Noob working through tutorial - kenjis - 03-06-2016

Can you show your all view file names?


RE: Noob working through tutorial - muckydog - 03-06-2016

(03-06-2016, 03:34 PM)kenjis Wrote: Can you show your all view file names?

views/pages/home.php

Code:
<p>Hello World!</p>

<p>This is the home page!</p>


views/pages/about.php

Code:
<p>Hello World!</p>

<p>This is the about us page!</p>


views/templates/header.php

Code:
<html>
<head>
<title>CodeIgniter Tutorial</title>
</head>
<body>
<h1><?php echo $title; ?></h1>

views/templates/footer.php

Code:
<em>&copy; 2016</em>
</body>
</html>



RE: Noob working through tutorial - InsiteFX - 03-06-2016

Did you add the routes to the routes file?


RE: Noob working through tutorial - pdthinh - 03-06-2016

(03-06-2016, 11:29 AM)muckydog Wrote: Brand spanking new to CI and have followed the install and initial tutorial instructions step by step. Does not work according to plan on my localhost. Thought it might be something wrong with my local setup, so tried on remote web server with same issues.

After installation, the index.php page shows as expected: http://www.geopd.org/membership/index.php

After following Static Pages tutorial, I get this: http://www.geopd.org/membership/index.php/pages/view/

Any helpful suggestions for where to look for solutions much appreciated!

You have a white space between <? and php, remove it and try again.


RE: Noob working through tutorial - kenjis - 03-06-2016

(03-06-2016, 03:00 PM)muckydog Wrote: application/controllers/Pages.php

<? php
class Pages extends CI_Controller {

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);
}

}

Probably this has nothing to do with your problem, but
`show_404` is wrong. It should be `show_404()`.


RE: Noob working through tutorial - arma7x - 03-06-2016

http://www.geopd.org/membership/index.php. Make sure the APPPATH is correct. Application folder & index.php is under membership folder ? You can define APPPATH in index.php file.


RE: Noob working through tutorial - Code4fun - 03-07-2016

When I enter the url http://www.geopd.org/membership/home without the index.php I see a members login page...