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 8701147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:19:36+00:00 2026-06-13T02:19:36+00:00

I’m creating an ebay-style (but more simplistic) shop in CodeIgniter and I’d like to

  • 0

I’m creating an ebay-style (but more simplistic) shop in CodeIgniter and I’d like to know the best way to handle the items code/controllers.

At the moment, I’ve got a Category controller which is the main controller (in routes). /category/id is supposed to show a list of items for a specific category, and /category or / shows all items.

The category index($id=0){} in the controller loads the category helper which generates the category listing, then I echo it out in the view.

Now I’m up to the stage of adding the items aspect… Users need to be able to add items, view specific items, and the category code needs to be able to show all items or a specific category of items.

I was thinking of having a items controller with add_item, view_item, however now I’m wondering how I should be fetching the category listing from within the categories controller.

Should I have a items helper that loads the items model, fetches the list of items based off the category, assigns the list to a variable and echos the list? And when a user wants to view a specific item it loads the item controller view_item, and for adding add_item etc?

I also want the categories to display whilst they’re viewing an item, so if I do it this way I’ll also need to load the category helper within the items controller… Is this bad practice due to code repetition?

  • 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-06-13T02:19:37+00:00Added an answer on June 13, 2026 at 2:19 am

    In short, here’s what I would do.

    • /, Shows all items.
    • /category/xyz, Shows all items of category XYZ.
    • /item/view/xyz, Shows item XYZ.
    • /item/add, Adds an item.
    • …

    It’s normal to reuse your models across your controllers. It would be scary otherwise; it would mean a lot of code duplication. It’s also normal to reuse your helper as much as possible. That’s the goal of an helper! To implement a function that is reused at a lot of places. When you start to do copy + paste of the same lines, that’s when you are not doing reuse. Create a function and reuse it.

    Keep in mind,

    • Models deal with your data. (Categories, items, bid, …)
    • Controller deals with your HTTP requests and responses. (Loading the right models, outputting the right views, …)
    • Helper deals with frequent operations. (On your models, on your views, on your requests, …)

    Hope this helps.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.