Exemple #1
0
 /**
  * Default routine to generate html for the form
  * @return string html for the form and any wrapping template
  */
 private function formTemplate()
 {
     // routine to apply templates to simple forms
     if (is_object($this->tplf) and strcmp(strtolower(get_class($this->tplf)), '\\w34u\\ssp\\template') == 0 or $this->tplf != "") {
         if (is_string($this->tplf)) {
             // template name supplied
             $form = new \w34u\ssp\Template($this->tData, $this->tplf, false);
         } else {
             // template object supplied
             $form = $this->tplf;
             $form->restart($this->tData);
         }
         // prevent escaping of html form fields
         foreach ($this->elements as $key => $el) {
             $form->ne($key);
             $form->ne($key . "Desc");
             $form->ne($key . "ErrorList");
             if ($el->type == "radio") {
                 $radioElementNumber = 0;
                 foreach ($el->data as $dataValue) {
                     $form->ne($key . "_" . $radioElementNumber);
                     $radioElementNumber++;
                 }
             }
         }
         $form->ne("errorList");
         $form->ne("formAction");
         $form->ne("formHidden");
         $formResult = $form->output();
         if (is_object($this->tpl)) {
             $this->tpl->display = false;
             $this->tpl->setData($this->tplElement, $formResult);
             $this->tpl->ne($this->tplElement);
             $output = $this->tpl->output();
         } else {
             $output = $formResult;
         }
     } else {
         \w34u\ssp\SSP_error("Form::formTemplate {$this->name}: Please supply a form template name or object in ->tplf");
     }
     return $output;
 }
Exemple #2
0
*   +44 (0)1273 201344
*   +44 (0)7833 512221
*
*   Project:	    Template routines test
*   Routine:	test1.php
*   Created:	12/05/2006
*   Descrip:	Testing basic template functionality, just replacing title and a couple of single line tags.
*
*   Revision:	a
*   Rev. Date	12/05/2006
*   Descrip:	Created.
*/
require_once "include.php";
$display = false;
$title = "Test 1";
$page = new \w34u\ssp\Template($title, "test1.tpl", $display);
$page->includeTill("include1");
if ($display) {
    echo '<p>Include 1 replaced</p>';
} else {
    $page->output .= '<p>Include 1 replaced</p>';
}
$page->includeTill("include2");
if ($display) {
    echo '<p>Include 2 replaced</p>';
} else {
    $page->output .= '<p>Include 2 replaced</p>';
}
$page->displayFooter();
if (!$display) {
    echo $page->output;
Exemple #3
0
/**
*   Site by w34u
*   http://www.w34u.com
*   info@w34u.com
*   +44 (0)1273 201344
*   +44 (0)7833 512221
*
*   Project:	    Template routines test
*   Routine:	test2.php
*   Created:	12/05/2006
*   Descrip:	Same as test 1 but checking the find template code.
*
*   Revision:	a
*   Rev. Date	12/05/2006
*   Descrip:	Created.
*/
require_once "include.php";
$display = true;
$content = array("title" => "test 3", "firstMultiple" => "First multiple replace", "include1" => "<p>Include 1 replace</p>", "secondMultiple" => "Second multiple replace", "thirdMultiple" => "Third multiple replace", "forthMultiple" => "Forth multiple replace");
$page = new \w34u\ssp\Template($content, "test3.tpl", $display);
$page->includeTill("include2");
if ($display) {
    echo '<p>Include 2 replaced</p>';
} else {
    $page->output .= '<p>Include 2 replaced</p>';
}
$page->includeTill();
if (!$display) {
    echo $page->output;
}
Exemple #4
0
*   Site by w34u
*   http://www.w34u.com
*   info@w34u.com
*   +44 (0)7833 512221
*
*   Project:	Simple site protection
*   Routine:	returnLined.php
*   Created:	30/05/2006
*   Descrip:	Replace tags.
*
*   Revision:	a
*   Rev. Date	30/05/2006
*   Descrip:	Created.
*/
error_reporting(E_ALL);
require_once "include.php";
$display = true;
$content = array("title" => "Return Lines", "firstMultiple" => "First multiple replace", "include1" => "<p>Include 1 replace</p>", "secondMultiple" => "Second multiple replace", "thirdMultiple" => "Third multiple replace", "forthMultiple" => "Forth multiple replace", "blank" => "");
$page = new \w34u\ssp\Template($content, "returnLines.tpl", $display);
$page->numberReturnLines = 2;
$page->includeTill("include2");
if ($display) {
    echo '<p>Include 2 replaced</p>';
} else {
    $page->output .= '<p>Include 2 replaced</p>';
}
$page->includeTill("end");
if (!$display) {
    echo $page->output;
}
var_dump($page->returnedLines);