OOP请让我直截了当。 [英] OOP Please set me straight.
问题描述
大家好。
我有一个项目,我将要开展工作,并创建了一个html助手类。如果我自己这么说的话,那堂课看起来还不错。 :)
我想我错过了OOP的大局。我使用这个帮助器类的方式是在我的索引文件中,如下所示:
[PHP]
$ html-> TROpen();
$ html-> TDOpen();
echo"& nbsp;" ;;
$ html-> TDClose( );
$ html-> TDOpen();
$ html->输入(''submit'',''submit'',''保存数据'');
$ html-> TDClose();
$ html-> TRClose(); [/ PHP]
这当然会使用提交按钮构建两个td单元格。我所看到的看起来不正确的是,这类似于程序编程而不是OOP。在我重复了这个例如10 td细胞的序列之后,我认为必须有更好的方法来做到这一点。
在我看来,也许我应该将助手类扩展到另一个类,在那里我构建我需要的不同框,然后在我的索引文件中调用这些框。我对此是否正确?
我觉得我几乎在那里寻求理解如何实施OOP。 :)
感谢您的任何意见!
Frank
Hello everyone.
I have a project that I am going to be working on and I have created a html helper class. That class looks pretty good if I do say so myself. :)
I think I am missing out on the big picture of OOP though. The way in which I am using this helper class is in my index file like so:
[PHP]
$html->TROpen();
$html->TDOpen();
echo " ";
$html->TDClose();
$html->TDOpen();
$html->Input(''submit'',''submit'',''Save Data'');
$html->TDClose();
$html->TRClose();[/PHP]
This of course will build two td cells with a submit button. What I am seeing that does not look right is that this resembles more procedural programming than OOP. After I have repeated this sequence of, for example, 10 td cells, I am thinking that there has to be a better way to do this.
It seems to me that maybe I should be extending the helper class to a different class where I build the different boxes I need then call those boxes in my index file. Am I correct on this?
I feel like I am almost there guys in my quest for understanding how to implement OOP. :)
Thank you for any input!
Frank
推荐答案
html-> TROpen();
html->TROpen();
html-> TDOpen();
echo"& nbsp;";
html->TDOpen();
echo " ";
html-> TDClose();
html->TDClose();
这篇关于OOP请让我直截了当。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!