开发者

Changing content of php page

I wanted to know if there is something like a content place holder in php..like the one w开发者_JAVA技巧e use in asp..I have my index.php and I want only a part if the page to be updated, I am using css.I was thinking about making a copy of the index.php then rename it to, for example, register.php. then change the css tags where needed. Is it how it's done? There are parts in the index.php that will remain fixed. For eg: list categories, sub categories. Now i want to implement a registration section. The list of categories should still be there and part of the index.php will change..


ASP.NET is object-oriented out of the box, whereas PHP is not. As such, there's no native "placeholder" to PHP. If you want this type of functionality, you ought to use a MVC framework like Kohana. That, or you could create your own simple template.

For instance, here is simple page:

<?php 
  include("header.php");
  include("navigation.php"); 
?>    

<h1>About Us</h1>
<p>This is our About Us page.</p>

<?php 
  include("footer.php"); 
?>

In this example, you'd have parts of your page that are relatively constant (header, navigation, footer, etc) all stored as pieces that are included within your primary files, such as index.php, aboutus.php, and gallery.php. In the above example, we see what a simple "about us" page could look like.

This model is relatively popular amongst young programmers, but if you're somewhat familiar with object-oriented frameworks, I'd encourage you to look at Kohana instead and work toward getting familiar with the Model-View-Controller method of development.


if you are using php then just create a simple header ,footer and navigation section for all the page that you require and include that file where u require such like master page in asp.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜