Idiomatic PHP web page creation

Posted by GreenMatt on Stack Overflow See other posts from Stack Overflow or by GreenMatt
Published on 2010-04-15T19:03:42Z Indexed on 2010/04/15 19:13 UTC
Read the original article Hit count: 229

Filed under:
|
|

My PHP experience is rather limited. I've just inherited some stuff that looks odd to me, and I'd like to know if this is a standard way to do things. The page which shows up in the browser location (e.g. www.example.com/example_page) has something like:

<?
$title = "Page Title";
$meta = "Some metadata";
require("pageheader.inc");
?>
<!-- Content -->

Then pageheader.inc has stuff like:

<?
@$title = ($title) ? $title : "";
@$meta = ($meta) ? $meta : "";
?>
<html>
<head>
<title><?=$title?></title
</head>
<!-- and so forth -->

Maybe others find this style useful, but it confuses me. I suppose this could be a step toward a rudimentary content management system, but the way it works here I'd think it adds to the processing the server has to do without reducing the load on the web developer enough to make it worth the effort.

So, is this a normal way to create pages with PHP? Or should I pull all this in favor of a better approach?

Also, I know that "<?" (vs. "<?php" ) is undesirable; I'm just reproducing what is in the code.

© Stack Overflow or respective owner

Related posts about php

Related posts about web-development