Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7574801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:31:34+00:00 2026-05-30T16:31:34+00:00

The hardest part I’m having with learning Codeigniter is the URI and URL ‘theory’

  • 0

The hardest part I’m having with learning Codeigniter is the URI and URL ‘theory’ if you will.

I followed the original tutorial concerning static pages, and now the code seems to mess EVERY single link up except the main nav bar, requiring me to constantly add routing parameters. I figure I must be doing something wrong.

In my controller, I currently have this code, based off the tutorial:

public function view($page = 'home') {}

My folder structure is:

+ applications
  + views
    - welcome.php
    + main
      + css
      + js
      - home.php
      - about.php
      - etc.php

I should point out that the welcome.php page is for the login page. On that page, a link will direct you to home.php (main/home/)

My routing code looks like this:

$route['default_controller'] = 'welcome';
$route['main/(:any)'] = 'main/view/$1';
$route['main/home/home'] = 'main/view/$1';
$route['404_override'] = '';

As you can see, I already had to put a bandaid on it with the <code>$route['main/home/home'] = 'main/view/$1';</code> portion, due to the fact that clicking on “home” while already on the home page would result in linking to main/home/home/ displaying my nav bar, and creating a brand new set of missing links labeled, main/home/about/

In short, I am now trying to reference a .js file and a .css file, but even though the links correctly point to /main/css/style.css it does not recognize it.

Here is my view code for the header (where i load my .css and .js)

<html>
    <head>
        <title><?php echo $title ?> - TownBuilder - Prototype</title>
        <link href="css/structure.css" rel="stylesheet" type="text/css">
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
        <script src="js/script.js"></script>
    </head>
<body>

<header>
    <ul>
        <li> <a href="profile"><?php echo $username ?></a></li>
        <li>Account</li>
    </ul>
</header>

Any advice on how to set up routing so that it works correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:31:35+00:00Added an answer on May 30, 2026 at 4:31 pm

    I think you should add the css/js file on the root directory(outsite of the application folder crete a folder called css) as CI has .htaccess files that deny all access to the application folder. You can only include those files from within your scripts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Check this link! I am having the hardest time trying to figure out why
Has anyone tried it? The hardest part for me is to get the height
I'm having the hardest time getting Eclipse to connect and reverse engineer from a
I am having the hardest time trying to figure out this (should be) simple
I am having the hardest time to get a simple sendmail.php to work. My
I really like Backbone, but I am having the hardest time doing what would
I'm having the hardest time figuring out why Firefox3.1 returns the value of 'content'
I am having the hardest time trying to get the current time in EDT
I'm having the hardest time trying to figure out how to balance an AVL
I'm having the hardest time figuring out how to remove home screen AppWidget's programmatically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.