Помогите разобраться в FastTemplates

HraKK

Мудак
Команда форума
Помогите разобраться в FastTemplates

Доки прочитал, факи изучил но от полезных ссылок не откажусь.

Дальше перешел на практику решил запустить example_1.phtml что входит в состав.

Apache 1.3.31 Windows PHP 5.1.1
вылазиет такая ошибка:
PHP:
Notice: Use of undefined constant main - assumed 'main' in e:\www\www1\tpl\example_1.php on line 12

Notice: Use of undefined constant table - assumed 'table' in e:\www\www1\tpl\example_1.php on line 13

Notice: Use of undefined constant row - assumed 'row' in e:\www\www1\tpl\example_1.php on line 14

Notice: Use of undefined constant TITLE - assumed 'TITLE' in e:\www\www1\tpl\example_1.php on line 18

Notice: Use of undefined constant NUMBER - assumed 'NUMBER' in e:\www\www1\tpl\example_1.php on line 27

Notice: Use of undefined constant BIG_NUMBER - assumed 'BIG_NUMBER' in e:\www\www1\tpl\example_1.php on line 28

Notice: Use of undefined constant ROWS - assumed 'ROWS' in e:\www\www1\tpl\example_1.php on line 32

Notice: Use of undefined constant NUMBER - assumed 'NUMBER' in e:\www\www1\tpl\example_1.php on line 27

Notice: Use of undefined constant BIG_NUMBER - assumed 'BIG_NUMBER' in e:\www\www1\tpl\example_1.php on line 28

Notice: Use of undefined constant ROWS - assumed 'ROWS' in e:\www\www1\tpl\example_1.php on line 32

Notice: Use of undefined constant NUMBER - assumed 'NUMBER' in e:\www\www1\tpl\example_1.php on line 27

Notice: Use of undefined constant BIG_NUMBER - assumed 'BIG_NUMBER' in e:\www\www1\tpl\example_1.php on line 28

Notice: Use of undefined constant ROWS - assumed 'ROWS' in e:\www\www1\tpl\example_1.php on line 32

Notice: Use of undefined constant MAIN - assumed 'MAIN' in e:\www\www1\tpl\example_1.php on line 35
{ {  {1} {BIG_1} 
{2} {BIG_2} 
{3} {BIG_3} 
}  }
 

HraKK

Мудак
Команда форума
Это пример, в нем ошибок не должно быть
 

HraKK

Мудак
Команда форума
PHP:
<?

// Example FastTemplate Demo #1 - The example from the man page

Header("Content-type: text/plain");

include("class.FastTemplate.php3");
$tpl = new FastTemplate("./templates");

$tpl->define(
	array(
		main    => "main.tpl",
		table   => "table.tpl",
		row     => "row.tpl"
	)
);

$tpl->assign( array( TITLE => "FastTemplate Test") );

for ($n=1; $n <= 3; $n++)
{
	$Number = $n;
	$BigNum = $n*10;

	$tpl->assign(
		array(
			NUMBER		=>	$Number,
			BIG_NUMBER	=>	$BigNum
		)
	);

	$tpl->parse(ROWS,".row");
}

$tpl->parse(MAIN, array("table","main"));

$tpl->FastPrint();

exit;

?>
 

_RVK_

Новичок
HraKK
Где ты выкапал этот пример? На самом деле пример видимо написан двно, потому автору простительно. Но я бы советовал с опаской относится к столь древним творения. И опыт был тогда у авторов не тот, и стандарты кода не до конца отработаны.
 

mit

Новичок
Сейчас должен работать
PHP:
<? 
// Example FastTemplate Demo #1 - The example from the man page 
Header("Content-type: text/plain"); 
include("class.FastTemplate.php3"); 
$tpl = new FastTemplate("./templates"); 

$tpl->define( 
    array( 
        "main"    => "main.tpl", 
        "table"   => "table.tpl", 
        "row"     => "row.tpl" 
    ) 
); 

$tpl->assign( array( "TITLE" => "FastTemplate Test") ); 

for ($n=1; $n <= 3; $n++) 
{ 
    $Number = $n; 
    $BigNum = $n*10; 

    $tpl->assign( 
        array( 
            "NUMBER"        =>    $Number, 
            "BIG_NUMBER"    =>    $BigNum 
        ) 
    ); 

    $tpl->parse("ROWS",".row"); 
} 

$tpl->parse(MAIN, array("table","main")); 
$tpl->FastPrint(); 
exit; 
?>
 

_RVK_

Новичок
mit
Гуру! Воистину!

-~{}~ 25.12.05 23:54:

HraKK
Поясни плиз, чем тебя заинтересовал конкретно FastTemplate?
 
Сверху