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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:16:58+00:00 2026-05-26T00:16:58+00:00

I am fairly far into a project, and am having trouble having everything included

  • 0

I am fairly far into a project, and am having trouble having everything included properly.
I have several files in different directories that need to include the same files, but since some are called via ajax or via includes in different situations, there path varies. I had a php_include path set up via .htaccess, but the testing server I need things set up doesn’t run with php commands in the .htaccess! I am trying to figure out a quick way of roping everything together.

I have multiple files all including the same ‘project’ file that in turn includes functions, etc. I have a $ROOT variable set-up to store the absolute path of my directories, but that’s not usable in includes without mucking with the php.ini, which I can’t do easily, and it’s included afterwards anyway.

I know a little bit about bootstrapping, and I would love to route everything through htaccess, but I don’t really have a concept of how to implement something like that really quickly and easily (and would that work for files called through ajax?)

I can’t rely on server_document_root because it may need to reside in a subdirectory.

This is not class based, but has value objects for database stuff.. there’s the main home.php, view.php etc in the root directory, then a program/ directory with the main scripts and value objects, then utilities and components folders that contain miniature view type classes.

I would redo everything if I had time, but right now I’m trying to figure out a way to have everything just work (preferably without dumping everything into one folder :p)

  • 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-26T00:16:58+00:00Added an answer on May 26, 2026 at 12:16 am

    In home.php, or view.php include your “main” file, this will include the rest of your app.

    require 'base.php';
    

    Its ok if home.php or view.php are in some other directory, just do whatever you need to do in that file to load base.php something like this will work the same:

    require '../base.php';
    

    Then in base.php

    $root = dirname(__FILE__);
    require $root.'/lib/mylib1.php';
    require $root.'/lib/mylib2.php';
    

    The __FILE__ is the full path to the current file, dirname gets its directory, then you can write all of your includes/requires relative to the location of base.php.

    I hope this helps point you in a helpful direction.

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

Sidebar

Related Questions

I am working on a fairly large project and have recently bumped into the
I'm very much new to programming and have been doing fairly well so far.
I'm fairly new to JS, here's what I have so far. I can get
Fairly simple question: I have an init method on my class that has the
I am writing a wordpress theme, and have run into a fairly basic problem.
i have an application that was written in delphi it is fairly recent, running
I'm fairly new to WCF development and have run into a couple problems whilst
I have a following fairly simple scenario: Some data needs to be written into
My highschool years are far behind and I'm having trouble remembering how to isolate
Here's an interesting architectural query. I have a piece of code that needs to

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.