Question

I do hope it is okay me asking this here, but I am learning PHP and I am really curious to know how are in theme templates created?

I am talking about the templates often seen inside forum software such as vBulletin, XenForo, IP. Board, MyBB, phpBB etc. They enable you to edit the site without opening core files.

Are they created with PHP? or are they a mix??? or...?

Was it helpful?

Solution

You're probably on about template engines, Namely Smarty

Some example code:

include('Smarty.class.php');

// create object
$smarty = new Smarty;

// assign some content. This would typically come from
// a database or other source, but we'll use static
// values for the purpose of this example.
$smarty->assign('name', 'george smith');
$smarty->assign('address', '45th & Harris');

// display it
$smarty->display('index.tpl');

the .tpl file

<html>
   <head>
      <title>Info</title>
   </head>
   <body>

      <pre>
         User Information:

        Name: {$name}
        Address: {$address}
      </pre>

   </body>
</html>

Replaces {$name} and {$address} with George smith and 45th & Harris.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top