Odrazu mowie php 4.
Mam coś takiego
index.php: <?
require("includes/initiate.php");
/* Ładowanie modółów */
include "pages/news.php";
$news = new news();
$news -> __construct();
$news -> show();
?>
news.php:<?php
class news
{
var $limit;
function __construct()
{
$this -> limit = "10";
}
function show ()
{
$db = new db();
$db -> connect( DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASES);
$Smarty = new Smarty();
$Smarty -> template_dir = 'templates/';
$Smarty -> compile_dir = 'templates_c/';
$s_SN = $db -> query ( "SELECT * FROM NEWS LIMIT ".$this -> limit.";" );
while ($row = $db -> fetch_assoc ($s_SN))
$newsy[] = $row;
$Smarty -> assign("news", $newsy);
$Smarty -> display('news.tpl');
}
}
?>
initiate.php:<?php
require( "libs/db.class.php" );
require( "libs/Smarty.class.php" );
require( "config.php" );
$db = new db();
$db -> connect( DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASES);
$Smarty = new Smarty();
$Smarty -> template_dir = 'templates/';
$Smarty -> compile_dir = 'templates_c/';
?>
Czy moge jakoś ominąc odpalanie klas db i smarty w funkcji show (news.php)

Żeby odpalały się w pliku initiate.php bo dodawanie odpalania klas smarty i db za każdym razem jest troche uciążliwe.