mhurier Smarty n00b
Joined: 20 Aug 2008 Posts: 4
|
Posted: Wed Aug 20, 2008 1:53 pm Post subject: probleme formulaire |
|
|
bonjour ,
voila je debut en smarty mais etant developpeur php mysl je ne suis pas perdu .
j ai un petit souci dans mon code ,je m explique : j ai un formaulaire d ajout
l ajout d un article fonctionne correctement par contre lorsque que je veux editer cette article la page du formulaire est vide , j ai bien mon formaulaire mais les champs sont vide alrs qu il devrait m afficher les infos a modifier.
voici la fonction :
Code: | function getEditSiteForm($racine = 0, $url = "index.php?cat=article")
{
global $CONFIG;
$smarty =& TemplateEngine::getInstance();
$myts =& MyTextSanitizer::getInstance();
[b]$lm =& get_manager("article");[/b]
$cm =& get_manager("category");
$str = "";
$id = isset($_GET["id"]) ? $_GET["id"] : (isset($_POST['id']) ? $_POST['id'] : 0);
$url_posted = isset($_REQUEST['url']) ? $_REQUEST['url'] : "";
$description = "";
$link =& $lm->get($id);
if(isset($_GET['Metas']) && $url_posted != '' && $url_posted != 'http://hight-definition.com/article.html?id=')
{
list($url_posted,$url_image,$name,$description) = preremplir_formulaire($url_posted,true);
$category_selected = $link->getVar('id_cat');
$description = !empty($description) ? $description : $link->getVar('des_art');
// $email = !empty($email) ? $email : $link->getVar('');
[b] $smarty->assign("nom_art",$link->getVar('nom_art'));
$smarty->assign("img_art",$link->getVar('img_art'));
$smarty->assign("des_art",$description);
$smarty->assign("date_debut",$link->getVar('date_debut'));
$smarty->assign("date_fin",$link->getVar('date_fin'));
$smarty->assign("affich_hp",$link->getVar('affich_hp'));
$smarty->assign("affich",$link->getVar('affich'));
$smarty->assign("baseline_art",$link->getVar('baseline_art'));[/b]
}
else
{
[b]$category_selected = $link->getVar('id_cat');
$url_image = $link->getVar('img_art');
$smarty->assign("nom_art",$link->getVar('nom_art'));
$smarty->assign("img_art",$link->getVar('img_art'));
//$smarty->assign("des_art",$link->getVar('des_art'));
$smarty->assign("date_debut",$link->getVar('date_debut'));
$smarty->assign("date_fin",$link->getVar('date_fin'));
$smarty->assign("affich_hp",$link->getVar('affich_hp'));
$smarty->assign("affich",$link->getVar('affich'));
$smarty->assign("baseline_art",$link->getVar('baseline_art'));
$description = $link->getVar('des_art');[/b]
}
$cols = array('id','name');
$categories =& $cm->getObjects(new Criteria('usable',1,'='),$cols);
if(count($categories) > 0)
{
foreach($categories as $category)
{
$id = $category->getVar('id');
$name = show_me_the_way($id);
if ($id == $category_selected)
{
$smarty->append("categories",array('name' => $name, 'value' => $id, 'selected' => 'selected="selected"'));
}
else
{
$smarty->append("categories",array('name' => $name, 'value' => $id, 'selected' => ''));
}
}
}
if($url_image != '' && $url_image != 'http://hight-definition.com/img_art/')
{
$smarty->assign("site_image",$url_image);
}
else
{
$smarty->assign("site_image",$CONFIG['site_url']."/themes/".$CONFIG['theme_dir']."/admin/images/nothumb.gif");
}
// Creating fckEditor Description field
displayFckEditor_article($description);
} |
voici un exemple d apelle de mon formulaire :
Code: |
<td width='100'>Nom :</td>
<td>
<input name="nom_art" type="text" size="43" value="[b]<{$nom_art}>[/b]" />
</td>
|
Ma variable $nom_art est vide
Pour infos j utilise freeglobe et que je développe pour mes besoin personel
Last edited by mhurier on Wed Aug 20, 2008 5:14 pm; edited 1 time in total |
|