开发者_Python百科Currently I'm using:
PrintHeader();
/* Page code... */
PrintBottom();
Is there a better way?
Any output shouldn't be done automatically. As not every script call may return a page of text. So, you have to call page renderer manually.
So, you can make it with single call CallTemplateRender();
Not a much difference though
Its best to separate your business logic and display code, I typically use a master php page with a variable that includes an inner php page. Something like this:
<html>
<head></head>
<body>
include($template_file);
</body>
</html
Then my logic page works like this:
//do processing
$set_variables;
$template_file = "inner_file.php";
include("master_template.php");
Of course its a little more involved than that but all of my logic and display is separate so it's easier to manage.
精彩评论