iskhan Posted April 4, 2010 Share Posted April 4, 2010 Scenario Base Class A and its Sub Classes are B, C, D, E, F Every class have a method B_Menu(), C_Menu(), D_Menu(), E_Menu(), F_Menu() respectively. And following Search_Form ($FileName,$Heading,$SubHeading) method with different x_Menu() method where x=B, C, D, E, F for every Sub Class mentioned in RED COLOR. <?php function Search_Form($FileName,$Heading,$SubHeading) { ?> <FORM method="POST" action="<?php echo $filename;?>"> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber1" height="344"> <?php $this->Page_Heading("$Heading"); ?> <tr> <td width="100%" height="51" colspan="2"><BR> <?php if($Heading=="REPORT")$this->B_Menu(); ?> <p align="center"><b><font size="4"> <u>SEARCH FOR <?php echo $SubHeading; ?></u></font></b></td> </tr> <tr> <td width="50%" height="51"><strong> User's ID :</strong></td> <td width="50%" height="51"> <p align="center"><input type="text" name="PatID" size="10"></td> </tr> <tr> <td width="100%" height="19" colspan="2"> ------------------------------------------------------<b>---------OR</b>-------------------------------------------------------------</td> </tr> <tr> <td width="50%" height="51"><strong> First Name :</strong></td> <td width="50%" height="51"> <p align="center"><select size="1" name="FName"> <option selected>Select First Name...</option> </select></td> </tr> <tr> <td width="50%" height="51"><strong> Last Name : </strong> </td> <td width="50%" height="51"> <p align="center"><select size="1" name="LName"> <option selected>Select Last Name...</option> </select></td> </tr> </table> <p align="center"> <?php $this->Submit_Reset(" Search "," Reset "); ?> </p> </FORM> <?php } ……….. Calling Search_Form ($FileName,$Heading,$SubHeading) method as follows: ObjA-> Search_Form (‘x.php’,’REPORT’,’Update’); ObjB-> Search_Form (‘y.php’,’REPORT’,’Delete’); : : : Question? If I move Search_Form ($FileName,$Heading,$SubHeading) method to Base Class A What changes are required? and how can I call it in any Sub Class? Quote Link to comment https://forums.phpfreaks.com/topic/197566-calling-special-base-class-method-in-drive-class/ Share on other sites More sharing options...
TeddyKiller Posted April 4, 2010 Share Posted April 4, 2010 1. Post your code in code/php tags. I can't help you as I cant read it. 2. Is repeated many times really required? 3. I see no red? Quote Link to comment https://forums.phpfreaks.com/topic/197566-calling-special-base-class-method-in-drive-class/#findComment-1036905 Share on other sites More sharing options...
iskhan Posted April 5, 2010 Author Share Posted April 5, 2010 CHECK THIS. IS MORE READABLE TO YOU? <?php function Search_Form($FileName,$Heading,$SubHeading) { ?> <FORM method="POST" action="<?php echo $filename;?>"> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber1" height="344"> <?php $this->Page_Heading("$Heading"); ?> <tr> <td width="100%" height="51" colspan="2"><BR> <?php if($Heading=="REPORT")$this->B_Menu(); ?> <p align="center"><b><font size="4"> <u>SEARCH FOR <?php echo $SubHeading; ?></u></font></b></td> </tr> <tr> <td width="50%" height="51"><strong> User's ID :</strong></td> <td width="50%" height="51"> <p align="center"><input type="text" name="PatID" size="10"></td> </tr> <tr> <td width="100%" height="19" colspan="2"> ------------------------------------------------------<b>---------OR</b>-------------------------------------------------------------</td> </tr> <tr> <td width="50%" height="51"><strong> First Name :</strong></td> <td width="50%" height="51"> <p align="center"><select size="1" name="FName"> <option selected>Select First Name...</option> </select></td> </tr> <tr> <td width="50%" height="51"><strong> Last Name : </strong> </td> <td width="50%" height="51"> <p align="center"><select size="1" name="LName"> <option selected>Select Last Name...</option> </select></td> </tr> </table> <p align="center"> <?php $this->Submit_Reset(" Search "," Reset "); ?> </p> </FORM> <?php } ……….. Calling Search_Form ($FileName,$Heading,$SubHeading) method as follows: ObjA-> Search_Form (‘x.php’,’REPORT’,’Update’); ObjB-> Search_Form (‘y.php’,’REPORT’,’Delete’); : : : Quote Link to comment https://forums.phpfreaks.com/topic/197566-calling-special-base-class-method-in-drive-class/#findComment-1037057 Share on other sites More sharing options...
iskhan Posted April 6, 2010 Author Share Posted April 6, 2010 hi I send you a working code without errors I can't understand "Post your code in code/php tags." May be I can't convey my issue Now another try a search() define in every sub class and in the search() another function of sub class menu() is call like this: search() { //screen design in html $this->menu();//this is the different line in every subclass because menu() is //different in every sub class //screen design in html } Because search() is repeat in all sub classes I want to move it on base class so what are the changes required to move search() into base class and how to call search() in every subclass with different menu(); Quote Link to comment https://forums.phpfreaks.com/topic/197566-calling-special-base-class-method-in-drive-class/#findComment-1037714 Share on other sites More sharing options...
KevinM1 Posted April 6, 2010 Share Posted April 6, 2010 'Putting code in code tags' means pressing the button with the '#' symbol, and putting your code between the two BBCode tags that appear. Regarding base class functionality vs. derived class functionality, is your search() method the exact same in all your derived classes, or are there differences between them? Quote Link to comment https://forums.phpfreaks.com/topic/197566-calling-special-base-class-method-in-drive-class/#findComment-1037765 Share on other sites More sharing options...
iskhan Posted April 7, 2010 Author Share Posted April 7, 2010 <?php function Search_Form($FileName,$Heading,$SubHeading) { ?> <FORM method="POST" action="<?php echo $filename;?>"> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber1" height="344"> <?php $this->Page_Heading("$Heading"); ?> <tr> <td width="100%" height="51" colspan="2"><BR> <?php if($Heading=="REPORT")$this->B_Menu(); ?> <p align="center"><b><font size="4"> <u>SEARCH FOR <?php echo $SubHeading; ?></u></font></b></td> </tr> <tr> <td width="50%" height="51"><strong> User's ID :</strong></td> <td width="50%" height="51"> <p align="center"><input type="text" name="PatID" size="10"></td> </tr> <tr> <td width="100%" height="19" colspan="2"> ------------------------------------------------------<b>---------OR</b>-------------------------------------------------------------</td> </tr> <tr> <td width="50%" height="51"><strong> First Name :</strong></td> <td width="50%" height="51"> <p align="center"><select size="1" name="FName"> <option selected>Select First Name...</option> </select></td> </tr> <tr> <td width="50%" height="51"><strong> Last Name : </strong> </td> <td width="50%" height="51"> <p align="center"><select size="1" name="LName"> <option selected>Select Last Name...</option> </select></td> </tr> </table> <p align="center"> <?php $this->Submit_Reset(" Search "," Reset "); ?> </p> </FORM> <?php } Quote Link to comment https://forums.phpfreaks.com/topic/197566-calling-special-base-class-method-in-drive-class/#findComment-1038233 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.