Here is the code I'm using for my class...
<?php
class displaypage{
function titlebar(){
include('../main/head.inc');
}
function styles(){
include('../main/styles.inc');
}
function mainmenu(){
include('../main/mainmenu.inc');
}
function pagehead(){
include('../main/title.inc');
}
function display(){
echo '<html>';
$this->pagehead();
$this->styles();
echo '<body>';
$this->titlebar();
$this->mainmenu();
echo '</body></html>';
}
}
?>
Here is the code I'm using for my subclass...
<?php
include('../main/inventory.php');
class workstations extends displaypage{
var $process;
function pointer(){
echo '<div style="top: 71px;left: 173px;position: absolute; z-index: 501;"> <img src = "../graphics/sm_downarrow.gif"> </div>';
}
function submenu(){
include('workstationsmenu.inc');
}
function processpage($includeprocess){
if(!$includeprocess){
$this->process = "";
}
else{
$this->process = $includeprocess;
}
}
function display(){
echo '<html>';
$this->pagehead();
$this->styles();
echo '<body>';
$this->pointer();
$this->titlebar();
$this->mainmenu();
$this->submenu();
include ($this->process);
echo '</body></html>';
}
}
?>
The problem is in the include statement in the subclass function display(). $includeprocess is a file name that can change from one page to another. Whatever that page be I need attributes passed to it so the PHP page in question can process those attributes. I did, at first, just put all the contents of that page into a variable instead of the page name. But that made manipulation of that page difficult. Is there a way to reference a page like above and still be able to pass attributes to it? I'm using 'method="POST"' in my forms and one of the pages that could be pulled up with the include statement above is...
<?php
$model = $HTTP_POST_VARS['model'];
$srvcnumber = $HTTP_POST_VARS['srvcnumber'];
$assetnumber = $HTTP_POST_VARS['assetnumber'];
$warrantymo = $HTTP_POST_VARS['warrantymo'];
$warrantyday = $HTTP_POST_VARS['warrantyday'];
$warrantyyr = $HTTP_POST_VARS['warrantyyr'];
$checkedout2LN = $HTTP_POST_VARS['checkedout2LN'];
$checkedout2FN = $HTTP_POST_VARS['checkedout2FN'];
$cdrominst = $HTTP_POST_VARS['cdrominst'];
$invenquery = "insert into workstations (assetnumber, model, srvcnumber, warrantymo, warrantyday, warrantyyr, checkedout2LN, checkedout2FN, cdrominst) values ($assetnumber, '$model', '$srvcnumber', $warrantymo, $warrantyday, $warrantyyr, '$checkedout2LN', '$checkedout2FN', $cdrominst)";
include ('../query/query.php');
mysql_query($invenquery);
include ('workstations.php');
$currentpage = new workstations();
$currentpage -> processpage('result.inc');
$currentpage -> display();
?>
Is there a better solution to this? Is there a better way to do this? Any help would be nice.
Jim