Jump to content

Recommended Posts

See this isn't working.
I made this framework, if it was working all the itme, it would speed up time, but now it's just more trouble than it's worth.
I have a folder called master.
In this folder I have a folder for
images, ajax, javascript, css, includes, processors, and portable.
images - carries all the images for the website
ajax, javascript, css - has a global.ext file for that specific type for all the website's stuff.
includes, processors - contains all the file's necessary for the website's includes.  Whether it's processor's that are dealing with contact us processing or something similar, or the include's for the website.
Portable - This has a mini version of each set of file's.  For instance if I wanted just the config file's without the directory structure, I can just pull that out and I have it, if I just need my library of javascript or ajax I can just pull those out for a specific purpose.  It's basically just a quick version of whatever I need.

I was happy with this, very happy.  I really liked the setup but now I am having trouble getting include's to work.
I can't get them all to work, I thought document root, then the filename was alway's going to work on most/any server's.  However before I even use it 3-4 time's I run into a site giving me problem's with the include's, I even ran chmod on the file's I needed before using them, but it's not working.  Is there a permanent way to make this work.  Or should I change the way I am doing my functions.
Link to comment
https://forums.phpfreaks.com/topic/25577-advice-about-framework/
Share on other sites

its really shouldn't be too difficult. Maybe take a look at the [url=http://php.net/set_include_path]set_include_path[/url] function. I allways append my includes directory to the include path, its just easier.

If you have access to the php.ini you can also set this there.
Still absolutely nothing.
I tried the set include path with everything but it's not working.
I tried setting it like
you showed but with a url of
$docroot . "/master/includes/"
or
$docroot . "includes"
"/master/includes"
"includes"
nothing is working.
This really is pretty simple stuff, I just don't know what to say really. Can you show us your exact file structure somehow? Or even just an example? What part of the set_include_path function don't you understand and can we see how you tried to impliment it?
[quote]I tried setting it like
you showed but with a url of[/quote]

Sorry, but I havent posted any examples so Im not sure what your talking about here.
Ok
I was having this work fine earlier.
Here is a cut down of my entire directory structure and explanation.
Inside the root directory of the website.
Whatever the actual root is
So if the website is www.freelancebusinessman.com for instance
it's in the public_html folder, whatever the root directory is.
Ok
inside the root directory i have a folder called
master
this is what I am also calling my framework, I wanted an easy way to organize my folder structure.
Inside the master folder I have the following folders.
images (still debating on whether I am going to have these in the framework or not, it would make it easier to keep up with.
config - It contains config.php and a folder called functions (this folder is what I ahve my function incluide's at, and the one I am currently having trouble accessing.
In master folder I also have
ajax, javascript, css folder's each one with global.ext(there filename).
I also have portable folder, which is a cut down version of the framework without the folder structure.
So here is the total setup of my direction structure

folder structure
master
images, css, javascript, ajax, portable, config, includes
The inside of those folder's it's
images (the images)
css, javascript, ajax (global.css, global.js, global.js(for javascript), respectively.)
config (config.php, functions (the one I am having trouble getting to include into config.php which was working earlier)
includes (my website includes, this I don't seem to be having problem's with, atleast never have before.)
and that's the folder structure
I don't understand, I never had problems getting the include to work before.
I tried doing a few things.  Here is my entire config.php file


[code]<?php
session_start(); // starts session automatically
##################################################################
#          Joyel Puryear / Master Configuration System          #
#                  The Freelance Businessman                    #
#              http://www.freelancebusinessman.com              #
#                Copyright Joyel Puryear 2006                  #
#                    &copy;Master Framework                      #
##################################################################
/* Config File for the master framework */

// Master Variables
$docroot = $_SERVER['DOCUMENT_ROOT'];
$contactemail = "businessman332211@hotmail.com";
$elevel = 1; // level of error function (either 0 for off, 1 for on)
$dbactive = "yes"; // either yes or no
$dbhost = "localhost"; // Normally local host
$dbusername = "######";
$dbpassword = "#####";
$db = "######";

// connection information
if ($dbactive = "yes") { // if yes perform db work
mysql_connect($dbhost, $dbusername, $dbpassword);
mysql_select_db($db);
}


// making my include's work properly
ini_set('include_path', $docroot . "/master/config/functions");

// Handling php security issues
require_once($docroot . '/master/config/functions/security.inc.php'); // security include
error($elevel); // function to set error level, defaulted to all and strict.
ini_set("magic_quotes_gpc", 0);
ini_set("register_globals", 0);

// include master function controller
include($docroot . '/master/config/functions/master.inc.php'); // master include
?>[/code]
Ok the docroot was working perfectly before, in all server's I tried it, but now I run into this

And no matter what I change the include path to it keep's happening.
I don't understand it much.
I tried setting it with set include path, and ini set but nothing is working.
I was hoping I could have include's that worked universally no matter what the structure.
Should I remove the functions folder, and just have them under config, but I wanted them seperated into a specific folder for functions.
I have 2 set's of incldues for the site, the includes with my functions for my framework
and include's for the site itself.
[code]ini_set('include_path',$_SERVER['DOCUMENT_ROOT'].'/master/config/functions/');
require_once('security.inc.php'); [/code]

If above doesn't work, the file is not there.

echo $_SERVER['DOCUMENT_ROOT'].'/master/config/functions/';

Above directory will not exist, or doesn't contain a file named 'security.inc.php'.
It has something to do with the damn permissions.
I just checked just now, and now all of a sudden it's saying access denied through ftp.
I tried earlier chaning around permission's but it never would let me on security.inc.php
do you tihnk I will run into this problem much with  my framework
I also went ahead and tried chmod it didn't work
I found out what it was.
Inside the document root, it traced it to
the root folder but left out the root
oakley folder.
So it left out that so I had to do $docroot . "oakley/master/whatever
and it finally worked, I had to do that on the css file's as well, put the oakley before the
PHP-included files (such as functions files, settings, whatever PHP itself includes) can be included using the server's FILESYSTEM path.  that is, it can be referenced by its absolute path on the server.  this path can be found in the phpinfo() output, and is often properly stated in $_SERVER['SCRIPT_FILENAME'] or $_SERVER['PATH_TRANSLATED'].  be careful that those will give the currently executing script, not the including script.

images, CSS and javascript that are referenced by HTML must be designated via URI paths.  that is, they need to have their paths specified either explicitly by URL (ie. http://www.freelancebusinessman.com/images/image.gif) or by reference to the web root, which is usually www/ or public_html/ in the filesystem (ie. images/image.gif).

the important part of this post is that you CAN NOT use the absolute filesystem path to specify image, CSS or javascript sources in HTML.  you must specify a URI, which often means you'll need one defined path for PHP includes and one defined path for HTML includes.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.