<?php function komunikat ($komunikat_msg) //wyswietla komunikaty na specjalnie przygotowaniej stronie { $_SESSION['komunikat']= $komunikat_msg; } ?>
wywyłuje ją w taki sposob z dowolnej podstrony strony:
<?php if (istnieje_email($adres)) // sprawdzam czy czasami nie istnieje juz email { $error_msg= \"Adres email znajduje sie już w naszej bazie.\"; komunikat ($error_msg); exit; } ?>
Plik komunikat.php gdzie przekierowywuje funkcja komunikat() wyglada tak:
<?php include ('admin/baza.php'); include ('Smarty.class.php'); $smarty= new Smarty(); $dzial= 'komunikat'; $wiadomosc= $_SESSION['komunikat']; $smarty-> assign ('komunikat', $wiadomosc); $smarty-> assign ('strona_top', $dzial); $smarty-> assign ('plik', $dzial.'.tpl'); $smarty-> display ('index.tpl'); ?>
a sam szablon Smarty tak:
Kod
<br />
<br />
<table align="center">
<tr>
<td>{$komunikat}</td>
</tr>
<tr>
<td align="center"><br /><br /><a href="javascript:history.back()" class="admin">powrót</a></td>
</tr>
</table>
<br />
<table align="center">
<tr>
<td>{$komunikat}</td>
</tr>
<tr>
<td align="center"><br /><br /><a href="javascript:history.back()" class="admin">powrót</a></td>
</tr>
</table>
Wiec jak na moje oko wszystko powinno chodzic "jak cza", zaznaczam ze wszedzie jest rozpoczete start_session(), chyba jednak mam problem z oczami bo nie chodzi.