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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:02:28+00:00 2026-05-21T14:02:28+00:00

I had a general question on proper design of a php files and their

  • 0

I had a general question on proper design of a php files and their storage on a server.

The problem is this: I had split a php object’s functions into different php files, something like:

File 1 AndroidFlashCard.php

class AndroidFlashCard {
    public function retrieveCards($packname){}
    public function retrievePacks(){}
    ....

File 2 RetrieveCards.php

include ($_SERVER['DOCUMENT_ROOT'].'/flash_card/AndroidFlashCard.php');
$connection = new AndroidFlashCard();
$connection->retrieveCards($_REQUEST['pack']);
...

Besides the bad code smell regarded making seperate php files for a single function calls, the problem happens when the location/name of class AndroidFlashCard changes. Suppose we go with this shoddy design and I have 1000 different functions…

The quick and dirty solution that came to mind was to have ANOTHER include file:

File 3 include.php:

include ($_SERVER['DOCUMENT_ROOT']./[location of class])

But this doesn’t really change anything, because if the location of the include.php file changes, I’d have to make 1000 changes again.

So let’s think about this. If I have to keep making 1000 changes to 1000 php files that only include a reference to a class and then code to execute a function, then maybe THAT is the design problem.

In android, I only know how to execute http requests, which is why I split the function calls into separate files.

If I could get hold of that php object, it would make things easier, but I’ve a feeling this will be difficult to accomplish.

What is the simpler solution? Is writing directory structures a design part of production work, which after approval, is simply just written in stone?

  • 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-21T14:02:28+00:00Added an answer on May 21, 2026 at 2:02 pm

    This sounds like a good case for class autoloading. When you attempt to use the class in say file 2, then php can call an autoload function to actually find the class to include. You will have to write the logic behind it, but thats 1 change rather then a 1000 as you say.

    __autoload($class_name)

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

Sidebar

Related Questions

just had a general question about how to approach a certain problem I'm facing.
This is a very general question but it's based on a specific problem. I've
I had a general question of what is going on when code like this
This is just a general/vague question, If i had a textarea... <textarea class=mybox> myfirststring
Had this working; at one stage. The problem is the following text is now
I had this problem before and can't for life of me remember how to
This started out as a general user question on Android forums. However it's become,
I've been learning to develop in Android and had more of a general question:
I don't have IE9 to mess around with this, so it's a general question.
I'm working in AS3, but I guess this could be a general question, so

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.