Ja korzystam z kilku gotowych rozwiązań:
a) smarty
b) PEAR::Archive
Jeśli idzie o sterowniki do baz danych to potrafię sam napisać do MySQL'a i PostgreSQL'a, a to przeważnie starcza.
Normalnie piszę struktóralnie, przy pomocy funkcji. Wydaje się że to głupota, bo każdy robi na funkcjach, jednak wierzcie mi nie zawsze tak było

.
Kod podzielony jest tak:
konto.php == includes/ko_global.php
telefony.php == includes/te_global.php
Wszystko bazuje na jednym pliku, jego brak to śmierć aplikacji, jest nim globals.php, w którym są wczytywane ustawienia itp. Oto jego źródełko
[php]<?php
function gen_www()
{
// $time[0] - sekundu // $time[1] - unix time stamp
$time = explode(" ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
$_sw['time'] = gen_www();
error_reporting( E_PARSE | E_ERROR | E_WARNING );
ini_set("display_errors", 1 );
ini_set("display_startup_errors", 1 );
ini_set("log_errors", 1 );
ini_set("error_log", "php_errors.txt" );
ini_set("ignore_repeated_errors", 1 );
if( empty( $_sciezka ) )
{
$_sw['sciezka'] = '';
}
else
{
$_sw['sciezka'] = $_sciezka;
}
include $_sw['sciezka'] . "config.php";
include $_sw['sciezka'] . "includes/smarty/Smarty.class.php";
include $_sw['sciezka'] . "smarty_config.php";
include $_sw['sciezka'] . "includes/functions.php";
include $_sw['sciezka'] . "includes/ssc_global.php";
include $_sw['sciezka'] . "includes/db_global.php";
include $_sw['sciezka'] . "includes/me_global.php";
include $_sw['sciezka'] . "includes/se_global.php";
include $_sw['sciezka'] . "includes/pldate.php";
$db = new sql_db( $_sw['db_host'], $_sw['db_user'], $_sw['db_pass'], $_sw['db_name'] );
usun_sesje();
if( !pobierz_sesje( ) )
{
nowa_sesja( );
}
define( "SID", pobierz_sid() );
define( "UID", pobierz_uid() );
define( "STATUS", pobierz_status() );
$smarty -> assign( 'sciezka', $_sw['sciezka'] );
$smarty -> assign( 'STATUS', STATUS );
function pokaz( )
{
global $smarty, $_sw, $db;
include $_sw['sciezka'] . "menu_config.php";
if( $url_args = $_SERVER['QUERY_STRING'] )
{
preg_match_all( '/([a-zA-Z-_]+)=(\w+)/', $url_args, $a );
$z = is_numeric( $a[2][0] ) ? $a[1][0] ."=x" : $a[1][0] ."=". $a[2][0];
}
else
{
$z = "";
}
$pa = preg_match_all('/^\/(\w*\/)*(\w+\.\w{3,4})/', $_SERVER['PHP_SELF'], $p);
$page = $p[2][0] ."?";
$plik = $page . $z;
if( ! $menu[$plik] )
{
$i = $page;
}
else
{
$i = $menu[ $plik ];
}
switch ($i)
{
case "2C":
$smarty -> assign('menu_prawe', menu_prawe() );
$smarty -> assign('menu_lewe', menu_lewe() );
$plik = "uklady/2c.tpl";
break;
case "2R":
$smarty -> assign('menu_prawe1', menu_prawe() );
$smarty -> assign('menu_prawe2', menu_lewe() );
$plik = "uklady/2r.tpl";
break;
case "2L":
$smarty -> assign('menu_lewe1', menu_prawe() );
$smarty -> assign('menu_lewe2', menu_lewe() );
$plik = "uklady/2l.tpl";
break;
case "1R":
$smarty -> assign('menu_prawe', menu_prawe() );
$plik = "uklady/1r.tpl";
break;
case "1L":
$smarty -> assign('menu_lewe', menu_lewe() );
$plik = "uklady/1l.tpl";
break;
default:
$plik = "uklady/0.tpl";
}
$db -> close();
$end = gen_www();
$smarty -> assign('gen', substr( $end - $_sw['time'], 0, 5 ) );
$smarty -> assign('num', $db -> q_count );
$smarty -> assign('wie', $db -> r_count );
$db = ":)";
$smarty -> display( $plik );
}
function pokaz_admin( $menu = true )
{
global $smarty, $_sw, $db;
if( $menu )
{
$smarty -> assign('menu_prawe', $smarty->fetch('admin/menu_prawe.tpl') );
$smarty -> assign('menu_lewe', $smarty->fetch('admin/menu_lewe.tpl') );
}
$db -> close();
$end = gen_www();
$smarty -> assign('gen', substr( $end - $_sw['time'], 0, 5 ) );
$smarty -> assign('num', $db -> q_count );
$smarty -> assign('wie', $db -> r_count );
$db = ":)";
$smarty -> display( 'admin/index.tpl' );
}
?>[/php]
Mogę przy jego pomocy dwoma kliknięciami zmienić układ strony

.