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

ajouter un champ

 
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
titi
Smarty n00b


Joined: 11 Jan 2014
Posts: 1

PostPosted: Sat Jan 11, 2014 2:54 am    Post subject: ajouter un champ Reply with quote

Bonjour,

je voudrai ajouter un champ divers a mes produits, problème mes ficher sons crypter je nais accès qu'au templates jais tester 2 solutions mais sa ne marche pas je ne suis pas du tout codeur pourriez vous m'aide merci d'avance.
Exemple

Solution 1
Je crée un ficher test.php

<?php

$sql='SELECT * FROM produits where produit';

$result=mysql_query($sql);

if (!$result){
die('erreur dans la requete: '.mysql_error());
}
while ($row=mysql_fetch_array($result,MYSQL_ASSOC)){

echo $row['produit'].'<br/>';

}


?>

Dans mon tpl

{include file="default/header.tpl"}
<table width="100%" border="0" height="">
<tr>
<td valign="top"><h3><img src="templates/default/resurces/img/produkte.png" /> {$smarty.const.b20}</h3></td>
</tr>
</table>

<form method="post" action="">
<table width="100%" cellpadding="0" class="table">
<tr>
<td><h4>{$smarty.const.b33}</h4></td>
<td><h4>{$smarty.const.b34}</h4></td>
<td><h4>{$smarty.const.b35}</h4></td>
<td width="2%" align="right" style="color:#FFF;"><strong>{$smarty.const.b63}</strong></td>
</tr>
{include_php file="templates/test.php" assign='test2'}

{foreach from=$myProduct item=myProduct }
<tr bgcolor="{cycle values="#F8F8F8,#FFFFFF"}" onmouseover="style.backgroundColor='#F8F8F8'" onmouseout="style.backgroundColor=''">
<td><img src="templates/default/resurces/img/id.png" border="0" /> <a href="#">#{$myProduct.produitID}</a></td>
<td><img src="templates/default/resurces/img/user.png" border="0" /> <a href="#">{$myProduct.produitDescription}</a></td>
<td><a href="#">{$test2}</a></td>
<td><div align="right">
{/foreach}
</table>
<div id="footer">Généré par Smarty {$smarty.version}</div>

{include file="default/footer.tpl"}


Sa ma fiche

ID......Description...........Divers
1........produit A..............divers a
.....................................divers b
.....................................divers c

2........produit B.............divers a
....................................divers b
....................................divers c


Solution 2

dans mon tpl

{include file="default/header.tpl"}
<table width="100%" border="0" height="">
<tr>
<td valign="top"><h3><img src="templates/default/resurces/img/produkte.png" /> {$smarty.const.b20}</h3></td>
</tr>
</table>

<form method="post" action="">
<table width="100%" cellpadding="0" class="table">
<tr>
<td><h4>{$smarty.const.b33}</h4></td>
<td><h4>{$smarty.const.b34}</h4></td>
<td><h4>{$smarty.const.b35}</h4></td>
<td><h4>{$smarty.const.b36}</h4></td>
<td width="2%" align="right" style="color:#FFF;"><strong>{$smarty.const.b63}</strong></td>
</tr>

{foreach from=$myProduct item=myProduct }
<tr bgcolor="{cycle values="#F8F8F8,#FFFFFF"}" onmouseover="style.backgroundColor='#F8F8F8'" onmouseout="style.backgroundColor=''">
<td><img src="templates/default/resurces/img/id.png" border="0" /> <a href="#">#{$myProduct.produitID}</a></td>
<td><img src="templates/default/resurces/img/user.png" border="0" /> <a href="#">{$myProduct.produitDescription}</a></td>
<td><a href="#">
{phph} $sql='SELECT * FROM produits where produit';

$result=mysql_query($sql);

if (!$result){
die('erreur dans la requete: '.mysql_error());
}
while ($row=mysql_fetch_array($result,MYSQL_ASSOC)){

echo $row['produit'].'<br/>';

}
{/php}</a></td>

<td><div align="right">
{/foreach}
</table>
<div id="footer">Généré par Smarty {$smarty.version}</div>

{include file="default/footer.tpl"}


Sa ma fiche

ID......Description...........Divers
1........produit A..............divers a
.....................................divers b
.....................................divers c

2........produit B.............divers a
....................................divers b
....................................divers c


Le problème c'est que divers b et c ne doive pas être dans ID 1 et divers c à par tien a un produit d'un autre client, pourriez vous me faire un code sil vous plais, je ne suis pas codeur, j'ai essayé mais sans notion pas évidant merci
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