> øhh... så lidt... kunne man få lov til at se koden?
Jowjow - men der er ikke noget avanceret i den...
Et før-billede (forkortet):
// Switch between the pages based on $pPageID
switch ( $pPageID )
{
case PAGE_VIEWPROFILE:
require_once "view_profile.php";
break;
case PAGE_PREFERENCES:
require_once "preferences.php";
break;
case PAGE_HOME:
$static_page = new Template("static/home.html");
$output->plug("[>HISTORY<]", " / Home");
$output->plug("[>CONTENT<]", $static_page->trim_content());
$output->plug("[>MENU<]", $static_page->trim_menu(), true);
$output->plug("[>CATEGORY1<]", "images/homeknapdown.jpg", true);
break;
// osv...
// This is where we go if $pPageID is not set - therefore it is also shown
as the first page
default:
// en masse kode
}
Et efter-billede:
// Switch between the pages based on $pPageID - different categories in
different files
include "index_home.php";
include "index_software.php";
include "index_services.php";
include "index_download.php";
include "index_support.php";
include "index_login.php";
// This is where we go if $pPageID is not set - therefore it is also shown
as the first page
if ( ingen af siderne herover er blevet vist)
{
// vis en standard-side
}
Hver af de inkluderede filer indeholder kun en switch (index_home.php vist
herunder):
switch ($pPageID)
{
case PAGE_HOME:
$static_page = new Template("static/home.html");
$output->plug("[>HISTORY<]", " / Home");
$output->plug("[>CONTENT<]", $static_page->trim_content(), true);
$output->plug("[>MENU<]", $static_page->trim_menu(), true);
$output->plug("[>CATEGORY1<]", "images/homeknapdown.jpg", true);
break;
case PAGE_ABOUTDNSPILOT:
$static_page = new Template("static/aboutdnspilot.html");
$output->plug("[>HISTORY<]", " / Home");
$output->plug("[>CONTENT<]", $static_page->trim_content(), true);
$output->plug("[>MENU<]", $static_page->trim_menu(), true);
$output->plug("[>CATEGORY1<]", "images/homeknapdown.jpg", true);
break;
case PAGE_NEWS:
$static_page = new Template("static/news.html");
$output->plug("[>HISTORY<]", " / Home");
$output->plug("[>CONTENT<]", $static_page->trim_content(), true);
$output->plug("[>MENU<]", $static_page->trim_menu(), true);
$output->plug("[>CATEGORY1<]", "images/homeknapdown.jpg", true);
break;
}
Hvis man tager index.php samt alle index_noget.php-filerne og sætter sammen
igen, vil man altså få:
// Switch between the pages based on $pPageID - different categories in
different files
switch ( $pPageID )
{
// kategori 1
}
switch ( $pPageID )
{
// kategori 2
}
....
// This is where we go if $pPageID is not set - therefore it is also shown
as the first page
if ( ingen af siderne herover er blevet vist)
{
// vis en standard-side
}
/Thomas