开发者

Need answer to the edit section of this question

Need your op开发者_运维问答inion on the edited part of this question i asked on stackoverflow. Been waiting for the whole day but no one's come back to answer that.

Do you think it is useful if you further separtae php and html in your Display pages?

Like In cases where we need to display minimal html like

<h2 align='center'> Appointment Control Panel V 1.0</h2>
<h2 align='center'>Your Next Appointments</h2>  
<div id=detail></div>

we make a function to render that and call it in our display rather than outputting html directly.

So maybe that helps to reuse that function in many other places.... And maybe we put many such functions in a common file which then can be included.

Do you think is this an overkill or it helps to reuse and make changes easily in one place or add new functions in case we want to change the looks, size, orientation and placement of something?


If you have common content in a bunch of files put it in it's own file and include it.

random_page.php

include( 'header.php' );
include( 'navigation.php' );

<h1>Random Page</h1>
<div>random content</div>

include( 'sidebar.php' );

include( 'footer.php' );

Now if you want to edit the header, just edit one file, instead of a bunch.

I do not recommend creating functions to echo common parts. It's not standard practice and to me it feels dirty echoing html at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜