I am trying my best to modulaize my code. This basically entails using an include like a function. I don't use functions because I want the form/table code in html so that I can change them using DWMX in design mode. As I understand it, using a function to call a form/table, would require me to echo the form/table to the page.
I enjoy coding php, and am getting a 'little better everyday'. When I get something working, I then like to put them in proper directories that make logical sense. In doing so I tend to break everthing and struggle getting the includes working with the '../' etc. method.
The other day I decided to try and figure a better way of doing things so that I could move on with the real work. But alas the soultion I came up with, while fixing some of my problems, breaks others.
In my main include (called by all), I coded the folloing:
define("ROOT", "c:/phpdev5/www/GotLeague/");
define("FORM_ADMIN", ROOT."forms/admin.php");
define("FORM_CLUBS", ROOT."forms/clubs.php");
define("FORM_DIVISIONS", ROOT."forms/divisions.php");
define("FORM_LEAGUE", ROOT."forms/league.php");
define("FORM_PICK_SPORT", ROOT."forms/pick_sport.php");
define("FORM_TEAMS", ROOT."forms/teams.php");
define("FORM_PLAYERS", ROOT."forms/players.php");
define("PROC_FORM_ADMIN", ROOT."forms/proc_form_admin.php");
define("LSETUP", ROOT."setup/league_setup/setup.php");
Now I can call any of these page coded with a define statement example: include FORM_ADMIN;
This only solves part of my problem, because if FORM_ADMIN includes LSTEUP, LSTEUP is built on a template that has img src, which uses ../../ etc to point to the image. Since LSETUP is included in the directory that may be n deep, while the img src is located x deep...img src is NOT found...
I would like to stay with this 'define' methodolgy if at all possible.
ok, rambling aside, there has to be a best practice to using includes and file structure. This is driving me crazy!....and it's not the first time I have tried on my own to address this.
Side note, I contacted my ISP, they do not allow folks to change their include_path in the php.ini. I do not want to be dictated to about where I store my php code by my ISP or the language.
Thanks to all for bearing with this old s370 assembler programmer.