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

Pseudo frames php

 
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: French
View previous topic :: View next topic  
Author Message
spiroid
Smarty n00b


Joined: 19 Sep 2006
Posts: 2

PostPosted: Tue Sep 19, 2006 1:05 am    Post subject: Pseudo frames php Reply with quote

Bonsoir

Je cherche à savoir quelles sont les solutions possibles pour réaliser un système de pseudo frames avec php et smarty.
Ma solution (en gros) pour le moment est la suivante :
Sur la page d'index :

1) Instanciation d'un objet smarty paramétré
2) Appel du template pour le header
3) Include php de la page à afficher (soit directement une page html, soit une page php qui appel a son tour appel un template si necessaire)
4) Appel du template pour le footer


Existe t'il d'autres solutions qui vous semblent interessantes ? , pertinentes ?
Toute remarque ou critique est la bienvenue.
Back to top
View user's profile Send private message
ciboulette
Smarty Regular


Joined: 13 Jul 2006
Posts: 45

PostPosted: Tue Sep 19, 2006 10:52 am    Post subject: Reply with quote

ba ta plusieur solution , mais apres c a toi de voir


solution 1 (php). tu inclus plusieur template.
Code:

$smarty->display('header.tpl');
$smarty->display('tapage.tpl');
$smarty->display('footer.tpl');


solution 2 (ça j'aime pas)
Code:

$smarty->display('header.tpl');
include 'tapage.php';
$smarty->display('footer.tpl');



solution 3 (dans le template de t pages)
Code:

{include file="header.tpl"}
ici ton code HTML
{include file="footer.tpl"}


tout est un peu pret identique (moi perso j'utilise la solution 3 (voir la 1 de temp en temp))
Back to top
View user's profile Send private message
spiroid
Smarty n00b


Joined: 19 Sep 2006
Posts: 2

PostPosted: Tue Sep 19, 2006 1:56 pm    Post subject: Reply with quote

Le probleme avec la solution 1 ou la solution 3 que tu me propose est que tu ne peux inclure que du html ou un template smarty mais pas de php. Or j'ai souvent besoin de réaliser un traitement specifique dans les pages appelées : connexions a une base de donnée, sauvegarde dans des fichiers etc.

J'utilise donc pour le moment la solution n°2.
Je te remercie de tes propositions. Si quelqu'un à d'autre solutions je suis preneur Smile
Back to top
View user's profile Send private message
ciboulette
Smarty Regular


Joined: 13 Jul 2006
Posts: 45

PostPosted: Sun Sep 24, 2006 10:53 am    Post subject: Reply with quote

heu c'est faux ça , avec la solution 1 :

[php:1:792d50c671]
<?php

include('includes/configure.php');
$db = mysql_pconnect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
mysql_select_db(DB_DATABASE);
$grid_manufacturers= array();

$req = mysql_query('SELECT * FROM manufacturers ORDER BY manufacturers_name');
while($data = mysql_fetch_assoc($req)){
array_push ($grid_manufacturers, $data);
}
$smarty->assign('grid_manufacturers', $grid_manufacturers);

$smarty->display('header.tpl');
$smarty->display('tapage.tpl');
$smarty->display('footer.tpl');
?>

[/php:1:792d50c671]

et avec le 3 c identique presque.
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: French 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