Hey guys and gals,
I have a question that is bugging me because I can't seem to figure out how different php based applications achieve it (curiosity killed the cat right). My question is this, how does forum/cms/etc software utilize functions in their templates without using php code to wrap each function. For example, if you were to build a function in php it might look like so:

<html>
<body>

<?php
function writeName()
{
echo "Kai Jim Refsnes";
}

echo "My name is ";
writeName();
?>

</body>
</html>

(Credit to W3schools for this example)

But if you look at say phpbb in your template file you have all sorts of words wrapped in {}'s.....example:

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

Joomla on the other hand uses kind of a <jdoc> include type function to bring pieces of its template together.

So my question remains how do they embed these kind of sub-languages into their php applications, is it through a second language like xml? javascript? etc? Or is it just a lesson I have failed see?

Member Avatar for diafol

These are templates, they adhere to HTML. The snippet above shows 'placeholders' for data. Many of these types of templaters available. Have a look at Smarty or RainTPL. They don't look quite as freaky as phpBB though ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.