Not just another template system (with screencast) |
[eluser]philpalmieri[/eluser]
Not just another template system (with screencast) So we have been working on this template system that we are now sharing. We built it to separate not only the design from the application, but the designers themselves. Follow with me for a minute: we use a cascading template that includes main outer templates, header, footer and content areas, along with css/js. Basically, the template system uses the URL to decide which template to parse, based on the file system path. URL: "site.com/foo/bar" will look in the template folder and use the document, content, header & footer. Then it looks in foo, if foo containes a doc, head, footer, or content it will override the previous one and use it. Each level can also include a css and js folder. This is useful so you can override styles based on the section of the site your in. I know it sounds a bit hacky, but its actually really efficient. Code: /templates You can pass variables, set custom areas, and override the templates at any point too. so for some code: We chose to call it "view" so that we don't confuse anybody internally who is used to working with views. Also, we still use CI views, but we use them as reusables for our modules. Those views then get passed into variables to use in the template. Code: //Load the lib Future: Pulling the JS/CSS minifying and even variable parsing/caching We will pull it out of our SVN soon and stick it on google code or something, but for now i'll just keep posting the zip files as we upgrade. 8 Minute Screencast http://vimeo.com/2170796 Download: http://www.page12.com/ci/viewlib/ViewLib.zip Default Demo templates http://www.page12.com/ci/viewlib/templates.zip
[eluser]ray73864[/eluser]
The screencast needs major improvements, it has a 'HD Preview' watermark across it and your colour scheme for 'TextMate' (black background) makes it hard to follow what you are doing.
[eluser]philpalmieri[/eluser]
Sorry was my first screencast. The origional (much easier to read than on vimeo) is at http://www.page12.com/ci/viewlib/introduction.mov For the watermark, didn't think it was that bad and didn't want to spend the $60 to buy the app Phil
[eluser]Maxximus[/eluser]
Thanks for sharing, it looks promising for sure! Screencast helped a lot to get a quick grip on it. Will give it a go next week. One question right now: somewhere in you screencast you mentioned css files needs a .css extension. Because I compress my CSS (and JS), I save the compressed files with a .php extension (and add cache control in it). Will that give any issues? @ray: Wasn't that bad. Have seen torrents far worse.
[eluser]philpalmieri[/eluser]
actually, now that you mention it - any file in the css/js folder will get picked up.
[eluser]philpalmieri[/eluser]
Also, would love constructive feedback on the screencast - aside from the TM theme, I was thinking of buying the software and doing a regular posting of them. I wasn't sure if there was a big enough demand for the videos. Phil
[eluser]patak[/eluser]
Hi, I found your extension and I am trying to build my own application. The application is in directory www root and I have error while render template. This is application tree Code: wwwroot Code: $config['template_dir'] = "/templates/"; Code: $config['template_dir'] = "/app/templates/"; When go to http://localhost/app/index.php/viewlib I get this errors Code: A PHP Error was encountered Code: $config['template_dir'] = "/app/templates/"; Code: $config['template_dir'] = "/templates/"; Code: Error: Template Directory Not Found! Could any one suggest what can be wrong, please Application without p12 extension is working fine.
[eluser]philpalmieri[/eluser]
Hi, it renders the template based on the URI - so, the index.php will screw it up.. add an htaccess file to mask the index.php and it should work for you. Also, this library has come a long way since this post - i'll be pushing up an update (backwards compatible) this week. Phil
[eluser]philpalmieri[/eluser]
sorry - actually the index.php doesn't matter (just realized that as i saved)... I hadn't tried using it in the application folder, try putting the templates folder right in the root www - and leave the template_dir as /templates/ Phil
[eluser]patak[/eluser]
Hi Phil it works only if templates directory is in the root www and copy of the templates folder in app folder. |
Welcome Guest, Not a member yet? Register Sign In |