Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

problem z funkcj? blokow?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish
View previous topic :: View next topic  
Author Message
damians
Smarty n00b


Joined: 05 Feb 2007
Posts: 1

PostPosted: Mon Feb 05, 2007 5:31 pm    Post subject: problem z funkcj? blokow? Reply with quote

Poni?ej znajduje si? przyk?ad z ksi??ki "Smarty- szablony w aplikacjach php" H.Haydera. Jest on na stronie 193. Nie wiem dlaczego funkcja dzia?a nie poprawnie.
funkcja_blokowa.php
Code:

<?php
require("Smarty.class.php");
$smarty = new Smarty;
$smarty->register_block("ban","check_words");
function check_words($params, $content, &$smarty, &$repeat)
{
$bad_words = explode(" ",$params['words']);
$words = explode(" ",$content);
for($i=0;$i<sizeof($words); $i++)
 {
  for($j=0; $j<sizeof($bad_words); $j++)
  if( $words[$i] == $bad_words[$j])
    {
     $words[$i]='xxxx';
    }
  $output = implode(" ",$words);
  return $output;
}
}

$smarty->display('register_block.tpl');
?>

register_block.tpl
Code:

<html>
<head>
</head>
<body>
{ban words="abc xyz"}
Mysle, ze ta abc ma ?adne xyz.
{/ban}
</body>
</html>
Back to top
View user's profile Send private message
broda100
Smarty n00b


Joined: 20 Feb 2007
Posts: 0

PostPosted: Tue Feb 20, 2007 12:41 am    Post subject: Reply with quote

Na pierwszy rzut oka masz b??d w trzeciej linii:
$smarty = new Smarty;

powinno by?
$smarty = new Smarty();
Back to top
View user's profile Send private message
broda100
Smarty n00b


Joined: 20 Feb 2007
Posts: 0

PostPosted: Tue Feb 20, 2007 12:41 am    Post subject: $smarty = new Smarty(); Reply with quote

Na pierwszy rzut oka masz b??d w trzeciej linii:
$smarty = new Smarty;

powinno by?
$smarty = new Smarty();
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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