You are here: Re: [SMARTY] Seperation of Logic and Presentation « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Seperation of Logic and Presentation

Posted by Markku Niskanen on 08/01/05 14:10

On Fri, 29 Jul 2005 13:49:30 -0400, you wrote:

>What do you guys think?

Well, this thread is a truly interesting one. It would be nice
to collect all wisdom and the various approaches together as
this is a very common problem and various approaches fit
for various tasks, I suppose.

As for myself most of my in-hoiuse applications are very simple
database browses/updates/reports and we have a very simple
header/left_menu/workarea approach. The main.tpl is basically:

<html>
<body>
<table>
<tr><td>header stuff</td></tr>
<tr>
<td width=200>{$menu}</td>
<td>{$content}</td>
</tr>
</table>

The $menu is filled by ai instance of a menu class and a script
that fills the menu according to login/user/group information.

The $content is filled by my browse/edit/other classes or scripts
and the index.php is normally something like the code below. I am
using get/put method variable $act as the active script include
file name.

<?php
include "/lib/Smarty/Smarty.php";
include "config/config.php";
include "/utils/utils.php";
include "/utils/session.php";

// build menu class instance and fill the {$menu} variable
include "scripts/menuis.php";

// fetch stuff from the active script (browse_customer. php
// for instance, if $act=="browse_customer")

if (file_exists("scripts/".$act.".php"))
include("scripts/".$act.".php");
else
include("$root_path/common/default.php");
$smarty->display("main.tpl");

?>

Depending on the application we are using our basic set of
templates (browse/update_form/report) and a mixture of
Smarty-driven ad-hoc templates or quick_and_dirty PHP code
when there is no need for elegancy. Every time, however, it
is Smarty that finally displays the page.

This is about as simple as it can get and suits very well for our
ultra-rapid application development which also quickened by a
set of wizards that create most of the basic screens friom the SQL
definition in minutes .

As for the classes I will publish at least some of them during
the autumn.

Markku

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация