Referencing Image with Front Controller Pattern
Posted: Tue Aug 22, 2006 7:29 am
Hi All,
I'm having problem with referencing image,css,javascript with this front controller pattern.
First, I'm working on a structure that will allow the design team and programming team work seperately, it goes like this:
The designer likes dreamweaver very much and he likes to see the refrencing images up there when testing on dreamweaver. So in the sometemplate.tpl he would reference the logo.jpg in the image folder using ../../../../image/logo.jpg, this can be done in DW really easy with relative path referencing. He is happy to see the image when having a test with DW.
Now I'm not happy! Since I do include_once("template/designer_jim/sub/cat_1/cat_2/cat_3/sometemplate.tpl") in the index.php as a controller, all images references screw up!
I post this problem in another thread here and thinking of copying that tpl file and use str_replace to replace those ../../ things in the image path with my own path,then save the processed template in the cache folder, but this involved openning and closing a file.
Doesn anyone know a better solution than this? I'm afraid the file opening and closing will slow down the speed. Can I avoid that while still keep the image referencing correct? This problem also occured when referencing css and javascript.
Hope I state the problem clear and hope to hear from you all.
With my best,
Jim
I'm having problem with referencing image,css,javascript with this front controller pattern.
First, I'm working on a structure that will allow the design team and programming team work seperately, it goes like this:
Code: Select all
www/index.php
/template
/cache
/designer_jim/
/css --- store all css from designer jim
/image --- store all images from designer jim
/logo.jpg
/script--- store all javascripts from designer jim
/common --- store all common header,footer,leftbar,rightbar... from designer jim
/sub --- store all other templates with multi-level categories
/cat_1
/cat_2
/cat_3
/sometemplate.tpl
/designer_tom/
/css
/image
/script
/common
...
/logic --- all application logics stored hereThe designer likes dreamweaver very much and he likes to see the refrencing images up there when testing on dreamweaver. So in the sometemplate.tpl he would reference the logo.jpg in the image folder using ../../../../image/logo.jpg, this can be done in DW really easy with relative path referencing. He is happy to see the image when having a test with DW.
Now I'm not happy! Since I do include_once("template/designer_jim/sub/cat_1/cat_2/cat_3/sometemplate.tpl") in the index.php as a controller, all images references screw up!
I post this problem in another thread here and thinking of copying that tpl file and use str_replace to replace those ../../ things in the image path with my own path,then save the processed template in the cache folder, but this involved openning and closing a file.
Doesn anyone know a better solution than this? I'm afraid the file opening and closing will slow down the speed. Can I avoid that while still keep the image referencing correct? This problem also occured when referencing css and javascript.
Hope I state the problem clear and hope to hear from you all.
With my best,
Jim