Jump to content


Photo

advice about framework


  • Please log in to reply
10 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 30 October 2006 - 01:31 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 30 October 2006 - 01:38 PM

its really shouldn't be too difficult. Maybe take a look at the set_include_path 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.

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 30 October 2006 - 02:28 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 30 October 2006 - 02:34 PM

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?

I tried setting it like
you showed but with a url of


Sorry, but I havent posted any examples so Im not sure what your talking about here.

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 30 October 2006 - 02:48 PM

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


<?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
?>
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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#6 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 30 October 2006 - 03:22 PM

ini_set('include_path',$_SERVER['DOCUMENT_ROOT'].'/master/config/functions/');
require_once('security.inc.php');

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'.

#7 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 30 October 2006 - 03:34 PM

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

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#8 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 30 October 2006 - 03:35 PM

You'll also want to make sure you include the current path, otherwsie things like PEAR may not be accesable.

ini_set('include_path',get_include_path().':'.$_SERVER['DOCUMENT_ROOT'].'/master/config/functions/');


#9 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 30 October 2006 - 03:48 PM

:o
I really, really don't get it.
He double checked the permission's they are all in order, I tried that it didn't work, I quadruple checked for the file, it's not working.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#10 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 30 October 2006 - 04:10 PM

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

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#11 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 30 October 2006 - 09:30 PM

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.freelance...mages/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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users