php in the presentation folder, and add the following
code in it. This is necessary for adding the link on the main page to the administration page.
class FirstPageContents
{
public $mLinkToAdmin;
public function __construct()
{
$this->mLinkToAdmin = Link::ToAdmin();
}
}
?>
3. Create a new file named admin.php in your site??™s root folder (tshirtshop), and write the following code
in it. You??™ll notice that admin.php is quite similar to index.php, except that in admin.php we don??™t check
the incoming link using Link::CheckRequest() and that we load a different template file.
// Activate session
session_start();
CHAPTER 10 ?– CATALOG ADMINISTRATION: DEPARTMENTS AND CATEGORIES 276
// Start output buffer
ob_start();
// Include utility files
require_once 'include/config.php';
require_once BUSINESS_DIR . 'error_handler.php';
// Set the error handler
ErrorHandler::SetHandler();
// Load the application page template
require_once PRESENTATION_DIR . 'application.php';
require_once PRESENTATION_DIR . 'link.php';
// Load the database handler
require_once BUSINESS_DIR . 'database_handler.php';
// Load Business Tier
require_once BUSINESS_DIR . 'catalog.php';
// Load Smarty template file
$application = new Application();
// Display the page
$application->display('store_admin.tpl');
// Close database connection
DatabaseHandler::Close();
// Output content from the buffer
flush();
ob_flush();
ob_end_clean();
?>
4.
Pages:
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396