[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.technology.phoenix] Re: Better template.php ?

Actually, most of the newer pages I create are set up for multi-language/localized content:

template.php:
-- snip --
# Place your html content in a file called content/en_template.php
include($App->getLocalizedContentFilename());

# Generate the web page
$App->generatePage(...)

--snip--

Where all my HTML content lies in content/[en|fr|de|etc...]_template.php, allowing for localized content.

D.



Denis Roy wrote:
Indeed, Bjorn's use of the output buffer makes a much cleaner (and better) implementation. Most of our pages use it, but I have yet to update the templates.

D.



Bjorn Freeman-Benson wrote:
That is the way I write pages for the eclipse.org website. See for example: /projects/europa.php
The only additional thing I use is:


$html = ob_get_contents();
ob_end_clean();
$App->generatePage( ..., $html, ... );

The ob_end_clean allows further code to write to the output stream normally. See http://us3.php.net/ob_get_contents

Michal Chmielewski wrote:
I am not very familiar with PHP but the $html = <<< EOHTML line is really making the HTML content be buried in the PHP code.
> ...
I read a little about output buffering in PHP and this template seems more logical to me and fixes these 2 issues.
Anything that I am missing ?