Add a page using the phpMyFAQ Template framework


It's easy:

  1. Build a template file and call it e.g. test.tpl and place it in the template/ folder:
        <!-- Start Test Content -->
    <h2>{testTitle}</h2>
    <span>{testContent}</span>
    <!-- End Test Content -->
  2. Build a PHP file called e.g. test.php(the base name must match with that of the template file) and save it in the root of phpMyFAQ:
    <?php
    $testTitle = 'My first PMF page';
    $testContent = '';

    for($i=0; $i<10; $i++) {
    $testContent .= 'Line '.$i.'<br />';
    }


    $tpl->processTemplate ('writeContent', array(
    'testTitle' => $testTitle,
    'testContent' => $testContent
    )
    );
    $tpl->includeTemplate('writeContent', 'index');
    ?>
  3. Register the variable e.g. "test" in config/constants.php in the array $allowedVariables;
  4. Now you can access the new test page via index.php?action=test.

 

Last update:
2012-07-14 15:32
Author:
Thorsten Rinne
Revision:
1.3
Average rating: 4.33 (6 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.

Comment of Graham Butler:
The test.tpl file should reside in the folder *beaneath* template/ that relates to the skin being ... show moreused. ie in the standard installation template/default/
Added at: 2012-12-13 21:04