• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie - Setup and URL Questions

I set up Codeigniter..left everything pretty much default. I was able to create a few pages and registration forms and so far so goo. My question is regarding urls and templates.

I have a mysite.php controller file. this performs the necessary functions to pass variables into my view pages to get the right content for my template.

function about() {
        $data['main_content'] = 'about';
        $data['page_title'] = 'Welcome to Diary 90';
        $this->load->view('template', $data);

I have a template file in views that pulls everything together




I then added a default controller called "mysite" to the routes config.

if I go to http://mysite.com I get the index page. Great.
if I go to http://mysite.com/mysite/about I get the about page. Ok.

1. How can i get the about page by just going to http://mysite.com/about. I can do that WITHOUT templates but not with one. I must have something set up incorrectly.

2. If I wanted a "members" area like http://mysite.com/members/index how do I set that up? do I create a subdirectory in the controllers dir called members?


1: Routes
2: Routes or a controller called members.

Read up on Routes in the userguide, wiki and this forum

Great. Thanks for the quick reply.

I read up on routes a bit and figured out how to eliminate the "controller" from the url.

so what I stated before about mysite.com/mysite/about is now mysite.com/about.

The other question is still open a bit. I found this post
...looks like what I am trying to accomplish but no dice.

i currently have

where mysite.php is the default controller. I would like member.php to be the members controller.

so if I go to mysite.com/members/index or mysite.com/members/welcome the member.php would take care of the pages. right now i keep getting 404. I added members to the routes.config but no dice either.

Am I on the right path?

Ahhhh...the default_controller is the default for the whole site, including subdirectories.

i had member/member.php and it was never finding it once i changed it to member/mysite.php which is the default all is well.

am i approaching this correctly?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.