|
Posted by Matthew Crouch on 09/09/05 16:48
Okay, I've come up with hacky workarounds every time I build an app, and
now I just need some tips on how to do this correctly and efficiently.
I usually have a head.inc and/or a constants.inc with definitions like
(SITE_ROOT,$_SERVER['SERVER_NAME']."/myApp);
(VERSION,"0.6.2");
(APP_ROOT, SITE_ROOT."/".VERSION);
(SMARTY_DIR, APP_ROOT . "/smarty");
(ADMIN_DIR, APP_ROOT . "/admin");
I'm sure you get the idea, and I bet you have them too. Some of these go
fine, but many of them are all screwed up, esp. any dealing with
-CSS (the stylesheets never seem to get included until my fourth attempt
at writing the URL)
-javascript (same)
-images (sometimes ... it seems like different servers treat the initial
slash in src="/thingy.png" differently?)
Anyway, I always run into these snags in the midst of some project, and
I figure out a hacky thing to just make it work. Now I want to get
input/tutorial links, etc. on how to do this right:
-do src= (script and img), action= (in a form), and href= (in a normal
"<a" link, and in a <link stylesheet) have different behaviors, or am I
imagining that?
-should I just build absolute paths for everything?
All advice greatly appreciated. If there isn't a single, definitive
tutorial, I might build one based on feedback here.
Thanks.
[Back to original message]
|