...

View Full Version : Code Optimisation Assitance



facets
09-21-2005, 04:09 AM
Any one keen to gice me some pointers frot he following code?
I'm sure there is a better way to write it.



<?
include_once "../includes/functions.inc.php";
include "../includes/common_db.inc";
include("template.inc");

//global $_REQUEST[$action];

$link_id = db_connect($db_materials);

if (isset($_POST['viewRecord'])) {viewPaperSummary($_POST['summaryId']);}
if (isset($_POST['viewFaceStock'])) {view($_POST['stockId']);}
if (isset($_POST['viewAdhesive'])) {viewAdhesives($_POST['adhesiveId']);}
if (isset($_POST['viewLiner'])) {viewLiners($_POST['linerId']);}
if (isset($_POST['searchNow'])) {fnSearchResults();}
if (isset($_POST['editSASummary'])) {view($_POST['summaryId']);}
if (isset($_POST['deleteSummary'])) {deleteSum($_POST['summaryId']);}
if (isset($_POST['submit'])) {updateSummary(); viewSearch();}
if (isset($_POST['viewSearch'])) {viewSearch();}

// Set varibale for switch action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';

switch($action) {

case "editStockSpec": fnViewFaceStockSpec(); break;
case "editAdhesiveSpec": fnViewAdhesiveSpec(); break;
case "editLinerSpec": fnViewLinerSpec(); break;
case "editSASummary": editSASummary(); break;
case "viewStockSpec": fnViewFaceStockSpec(); break;
case "viewAdhesiveSpec": fnViewAdhesiveSpec(); break;
case "viewLinerSpec": fnViewLinerSpec(); break;
case "viewAddFaceStock": fnAddFaceStock(); break;
case "addAdhesive": fnAddAdhesive(); break;
case "addLiner": fnAddLiner(); break;
case "addFs": fnCreateFs(); break;
case "addFaceStock": viewAddFaceStock(); break;
case "addSAStockSummary" : addSAStockSummary(); break;
case "Update" : updateSummary(); break;
case "submit" : updateSummary(); break;
case "searchNow" : fnSearchResults(); break;
case "viewPaperSummary": fnViewColloPaper(); break;
case "delete_record": delete_record(); break;
case "viewSearch" : viewSearch(); break;
default: showMenu(); break;
}

$tmpl->set_block('page', 'footer');
$tmpl->pparse('out', 'footer');
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum