|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Mlody_XX0 Smarty n00b
Joined: 21 Mar 2010 Posts: 1
|
Posted: Sun Mar 21, 2010 11:42 pm Post subject: problem z insertem kodu php z funkcją |
|
|
WItam wszystkich mam problem z wyświetleniem szablonów z książki : Smarty szablony w aplikacjach PHP
kod szablonu:
<html>
<head>
Code: | <title>Smarty LLC</fit1e>
</head>
<body>
<script language="JavaScript">
<!--
{literal}
function printMessage(str)
{
alert(str);
}
//-->
</script>
{/literal}
<img src="images/new.gif">
{insert name= "getCurrentTime" assign="current_time"
script="time_functions.inc.php"}
Bieżący czas: {$current_time}
|
kod tej funkcji z pliku time_functions.inc.php
Code: |
<?php
function smarty_insert_getCurrentTime()
{
return gmdate('l, j F Y g:i a T');
}
?>
|
wywala mi błąd :
Fatal error: Uncaught exception 'Exception' with message 'Syntax Error in template ".\templates\header.tpl" on line 12 "{insert name="getCurrentTime", assign="current_time", script="time_functions.inc.php" } " - Unexpected ", ", expected one of: "}" , " "' in D:\xampp\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php:432 Stack trace: #0 D:\xampp\smarty\libs\sysplugins\smarty_internal_templateparser.php(2579): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 D:\xampp\smarty\libs\sysplugins\smarty_internal_templateparser.php(2644): Smarty_Internal_Templateparser->yy_syntax_error(40, ', ') #2 D:\xampp\smarty\libs\sysplugins\smarty_internal_smartytemplatecompiler.php(47): Smarty_Internal_Templateparser->doParse(40, ', ') #3 D:\xampp\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(84): Smarty_Internal_SmartyTemplateCompiler->doCompile('<?xml version="...') #4 D:\xampp\smarty\libs\sysplugins\smarty_internal_template.php(259): Smarty_Internal_Template in D:\xampp\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 432
Ten plik PHP z funkcją jest w folderze libs oraz w folderze głównym tu gdzie index.php , a także stworzyłem folder plugins i tam wrzuciłem .
Ksiażka ta jest chyba na wersje 2.6 Smarty , ja pobrałem wersje 3.0 beta 8
Pozdrawiam serdecznie
[/code] |
|
Back to top |
|
kitsunefox Smarty n00b
Joined: 06 Apr 2010 Posts: 1
|
Posted: Tue Apr 06, 2010 4:19 pm Post subject: |
|
|
Jeśli się nie mylę to powinieneś wcześniej dać
{include_php file="twój skrypt"} przed insertem |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|