Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
problem z insertem kodu php z funkcją

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: Polish
View previous topic :: View next topic  
Author Message
Mlody_XX0
Smarty n00b


Joined: 21 Mar 2010
Posts: 1

PostPosted: Sun Mar 21, 2010 11:42 pm    Post subject: problem z insertem kodu php z funkcją Reply with quote

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=&quot;getCurrentTime&quot;, assign=&quot;current_time&quot;, script=&quot;time_functions.inc.php&quot; } " - 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 Smile
[/code]
Back to top
View user's profile Send private message
kitsunefox
Smarty n00b


Joined: 06 Apr 2010
Posts: 1

PostPosted: Tue Apr 06, 2010 4:19 pm    Post subject: Reply with quote

Jeśli się nie mylę to powinieneś wcześniej dać
{include_php file="twój skrypt"} przed insertem
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Language: Polish All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP