Welcome Guest, Not a member yet? Register   Sign In
Noob working through tutorial
#1

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!
Reply
#2

Can you post the code for the function you are running?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#3

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

}
Reply
#4

Can you show your all view file names?
Reply
#5

(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>
Reply
#6

Did you add the routes to the routes file?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(This post was last modified: 03-06-2016, 05:48 PM by pdthinh.)

(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.
Reply
#8

(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()`.
Reply
#9

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.
Keep calm.
Reply
#10

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




Theme © iAndrew 2016 - Forum software by © MyBB