views:

108

answers:

2

Hey all,

Just a general question for those of you working with the Smarty templating engine.

How are you setting up your file structure? I'd like to follow an MVC format, but I'm not sure how to include all the CSS, Javascript, etc. with the Smarty controller and templates without including these ridiculous paths.

Has anyone worked with this? Anyone have any insight?

Thanks! Matt

A: 
/
/includes/smarty
/includes/class.foobar.php
/includes/class.foobar2.php
/templates/myTemplate.tpl
/templates_c/

/js/
/js/jquery/jquery.js

/css/
/css/style.css
...

works nicely

including a file, which loads all stuff:

require_once 'includes/class.foobar.php';
require_once 'smarty/Smarty.class.php';
SkaveRat
+1  A: 

mmmmmm

I would recommend another structure.

suppouse this:

document root: my_app/public_html/

my_app/
   - lib
   - app
   - public_html/
     - css/
     - js/
     - images/
   - cache/
   - compiled_templates/
   - templates/
     - mails/
        - html/
        - text/
     - frontend/
     - backend/
     - xml/

in this was your templates are outside the document root, so.. are protected. In the other way.. anyway can go to my/site/templates/somefile.tpl

your _public_html_ folder should contain all files that users can access.

the lib folder contains the all utility classes you may use: smarty, database, etc..

the app folder contains all the bussines files, etc..etc.

anyway I think the most important point is to have the frontend and the backend in different levels.

saludos

Gabriel Sosa