Jump to content

Linking Structures


Recommended Posts

I will use a local linking stucture to illustrate my questions. You can read the forum titled "File Organization and Aliasing" for a larger picture of what im trying to accomplish.

I have three folders living in /htdocs/ A(main site), B(admin), & C(shopping cart). Inside each folder are files that have at line 1, <?php include('es_starter.php') ?>. es_starter.php is in folder /htdocs/includes/, this file is manditory for the site to run. Since there are many starter.php files inside /includes/ i have added a site abbreviation to each (example.. *es_starter.php*). Each sites starter.php file is pathed by way of an updated *include_path* in php.ini.

*A* is the main folded used on all sites. Inside of *A* is index.php. It has links to /B/index.php and /C/index.php. My question is how to get /B/index.php to properly call its site name abbreviated version of starter.php.

I can not hard code in the site abbreviation because all files in /B/ and /C/ are supposed to be universal used by all domains. I have thought that i could set a $_COOKIE on /A/index.php

[code]
setcookie("site", "es", time()+60*60*24*1000, "/");
include($_COOKIE[site]."_starter.php");
[/code]

that then gets read by all the other files, but deep linking will break this. I have also thought about reading the $_SERVER['SERVER_NAME'] variable then setting the abbreviation by that means but im not too sure. Any suggestions?
Link to comment
Share on other sites

So i think i have found a working work-around for this. but i thinkit just that a work-around. If anyone can suggest a better method please let me know.

[code]//File - /A/index.php or /B/index.php or /C/index.php

<?
include('whois.php');
include($GLOBALS['whois']."_starter.php");
?>
[/code]

[code]//File - /includes/whois.php

<?
if ($_SERVER['SERVER_NAME'] == 'www.sitename.com' || substr($_SERVER['REQUEST_URI'],0,22) == '/clients/EmpireEngine/') {

     $GLOBALS['whois'] = "es";

}
?>
[/code]
Link to comment
Share on other sites

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.