FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Understand Code in phpBB





Possum
Hi

I have decided to learn how phpBB works. overall_header.html

Code:
{META}
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>

<!-- IF S_ENABLE_FEEDS -->




I don't understand what code is used by the Brackets above. I know phpBB places text between the brackets. I need to learn the language so I can customize phpBB thank you..


Is it php, javascript, ?

thank you
Fire Boar
phpBB just takes the brackets and replaces them with stuff that it generates. That's all. The .html files aren't really HTML, they're just templates.
Possum
Wow.. Thats interesting..

Is that standard practice with php and mysql.

Thank you..
Bondings
It's a templating system of phpBB. I assume some other software have similar systems. They parse that file and replace everthing between brackets by what the values that are provided in the php files. (amongst other things like the if stuff)

But they could have made it to be *[]{SITENAME}[]* if they wished.
Fire Boar
Here is an oversimplification of how it might work.

Code:
<?php

function parse($file, $replacements)
{
  $template = file_get_contents($file);
  return str_replace(array_keys($replacements), array_values($replacements), $template);
}

echo parse('templates/date.html', array(
  '{TITLE}' => translate("Here is today's date."), // assuming some function translate() exists for i18n
  '{DATE}' => date('d/m/Y'),
));


Templating engines vary, some people just use plain PHP (myself included), but the general idea is to completely separate content from presentation. The template contains all the information needed to decide how the pages will look, and the PHP files worry about inserting the content.
Related topics
[Official] Best PHP Editor
islam is...
A search to make JS file even smaller-2306byte to 542
AJAX tutorial [2nd part now updated]
PhpBB or SMF?
PHP Forum - Help
algabra question driving me crazy help please.
About pascal programming language
post text not appearing?
A question about dictionary of lists -- Python
Another simple redirect code, please help
Problem with code that handles arrays and database updates
How does software communicate with hardware?
what are after dot function for?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.