Results 1 to 6 of 6

Thread: Template like... Move the script foldere to the public folder

  1. #1
    dop3 is offline Junior Member
    Join Date
    Oct 2008
    Posts
    3

    Default Template like... Move the script foldere to the public folder

    Hi all...
    first of all, I'm a pretty good php coder but i'm almost new about ZF.

    This is my question:
    I want my app to load scripts, css, img from a folder which name is defined in some why by the user... (let's say 'template1' folder , or 'tpl2' folder or whatever). So, I want to do this in order to give the user the possibility to change the "look&feel" (template) of the whole application!

    My folder structure is like the following:

    -Application
    -- ...
    -- views
    -- ...
    -Library
    -- ... (Zend Stuff)
    -Public
    -- templates
    --- css
    --- img
    -- index.php

    I've found a way to do this through setting the scripts path using the following code in my app init!
    [PHP]
    $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelp er('viewRenderer');
    // Change the path where to look for the scripts
    $viewRenderer->setViewBasePathSpec(':moduleDir' . DS .'views' . DS . $this->getApplicationTemplate());
    // $this->getApplicationTemplate() will return a string that is the actual template (eg. default)
    [/PHP]

    But, doing like this I have to create several subfolders (one for each 'template') in the view folder (that is not under the public folder) and several subfolders under a so called template folder under the public folder in order to have imgs, css, etc..
    I think it would be better with all the template1 stuff in a folder...

    Now, if it's clear what i want to do, what would be the best way to do this with Zend Framework.

    Thanks

    Marcello

  2. #2
    Eugen is offline Senior Member
    Join Date
    Sep 2008
    Location
    Croatia
    Posts
    400

    Default

    views in zend are not templates since zend dont support templates, so maybe you should consider integrating some template system like smarty or dwoo..

  3. #3
    dop3 is offline Junior Member
    Join Date
    Oct 2008
    Posts
    3

    Default mm

    I don't know...

    You know, it's not always a bad thing to be new in something... just becouse you can see things with no constraints...

    I mean... I know I can set the script folder... so i can dinamically switch between theese folder... so, even known that php is a template engine, I can have my own template system!

    Please, don't misunderstand me... I'm just supposing... and, since I'm new, I'm here to heard, read and learn from you all!!

    Thanks...

  4. #4
    Eugen is offline Senior Member
    Join Date
    Sep 2008
    Location
    Croatia
    Posts
    400

    Default

    i agree that php is a template engine but that works only for small projects..
    if you are doing some small cms, blog or something like that, and you don't have designer, etc then this approach will work..

    but if its for enterprise purposes then template system is need - even zend's site use framework + smarty as template engine..

    next thing: why you want to put all views in same folder?
    i don't see any reason why you want to do that, and i think that framework don't support this by default.. maybe to write your own view class..

    and no, you should never place any code in public accessible places..

  5. #5
    dop3 is offline Junior Member
    Join Date
    Oct 2008
    Posts
    3

    Default

    I just wrote wrong... I don't want to put my views in the same folder... but in different folders under each "template" folder...

    By the way... Smarty... I don't like it... for me it's to heavy. Performances will degrade!

    Thank you for your replies... I will study and i will let you know if i find a "for me" nice, right and smart way to do what It's in my mind...

  6. #6
    xorock is offline Junior Member
    Join Date
    Mar 2008
    Posts
    17

    Default

    Try phptal: PHPTAL :: Template Attribute Language for PHP Smarty is too slow, zend_view, in my opinion, is good for small projects.

Similar Threads

  1. modular setup has /public looking for public controller in default module
    By brian.fegan in forum Installation & Configuration
    Replies: 3
    Last Post: 07-15-2010, 01:43 PM
  2. Extra folder inside application folder
    By saulharo in forum Installation & Configuration
    Replies: 1
    Last Post: 05-30-2010, 05:33 PM
  3. Access Zend_Db_Table from Zend public folder
    By pamidi in forum Core Infrastructure
    Replies: 10
    Last Post: 12-04-2009, 12:53 PM
  4. Zend and "public" folder
    By PTA in forum Installation & Configuration
    Replies: 3
    Last Post: 05-01-2009, 06:26 AM
  5. Move php from the view to the model or controller
    By mschiefmaker in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 10-15-2008, 07:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •