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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:36:04+00:00 2026-06-11T11:36:04+00:00

I’m writing a PHP application which makes use of a modular structure. To modules

  • 0

I’m writing a PHP application which makes use of a modular structure. To modules are basically folder names, and those folders contain PHP files.

It looks something like this:

/modules
   /module1
   /module2
   /module3

My PHP application reads the content of the modules folder and saves the folder names to a table in my database. My modules table looks like this:

id | module  | active | order
1  | module1 | 1      | 2
2  | module2 | 0      | 1
3  | module3 | 1      | 3

After the modules folder have been read and the folder names have been saved to the database, i then fetch the rows from the table again. That way i can easily see which modules are active, and in which order i have to show them.

The problem with this method is that i have to do all of the above everytime a page is visited. Because the system doesn’t know when a module have been added or removed from the module folder. So by “reading the folder / saving it to the DB / and reading the DB again” seems to give to most up to date version. But i can imagine that this method is inefficient. I think this can be done better.


There’s one solution i’ve came up with. But i still don’t think that this is the best solution.

Solution 1

When a user visits the site, then do all of the above. Read the modules folder, save the folder names to the table (after clearing the table first) and then get the rows from the table and store that in a session. When the user navigates through the site i can simply iterate over the session.

Cons: Removed/Added modules will only be visible when the browser is closed and re-opened.

Improvements?

I’m sure there’s a more elegant way of doing this. Anyone any ideas?

  • 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-11T11:36:06+00:00Added an answer on June 11, 2026 at 11:36 am

    The flow should be the following:

    1. The administrator requests the modules list
    2. A script scans the well-known directory and builds a list of available modules
    3. The script reads from the database the load order of active modules
    4. The same script displays a list to give the admin the opportunity to activate modules and define the order
    5. Finally a piece of code commit the changes to the database, if any

    When a normal user requests a page

    1. The module subsystem reads from the database the modules names and order
    2. The module system loads modules from the well known directory based on the names stored in the db, in the order defined in the db

    I think this is the most efficient way.

    Disclaimer: IMHO this is a waste of time. You’d better learn a real framework, maybe an MVC one like CakePHP, or one of those widely used CMS like Drupal, Joomla or WordPress. This way you’ll have 1. A working system 2. A secure system 3. Reusable knowledge. There’s no need to reinvent the wheel, even for learning purposes. You’ll eventually speed up the process by learning from other’s successes (and failures).

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
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
I would like to count the length of a string with PHP. The string
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.