Forum CMS Made Simple FR
Comment obtenir les variables smarty disponibles dans un module? - Version imprimable

+- Forum CMS Made Simple FR (https://forum.cmsmadesimple.fr)
+-- Forum : Général (https://forum.cmsmadesimple.fr/forum-3.html)
+--- Forum : Modules, Tags (https://forum.cmsmadesimple.fr/forum-14.html)
+--- Sujet : Comment obtenir les variables smarty disponibles dans un module? (/thread-4032.html)



Comment obtenir les variables smarty disponibles dans un module? - archeo - 19/06/2017

Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~
#~ Version du CMS: ?
#~ Url du site :
#~ Hébergeur / Soft :
#~ Informations Système :
#~~~~~ FIN BLOC A NE PAS SUPPRIMER ~~~~~


Bonjour,
La liste de ces variables n'est pas toujours disponible dans la documentation du module. On en a une idée en examinant les gabaris d'exemple fournis avec le module. Je voulais savoir s'il existait un moyen plus efficace d'en avoir le listing exhaustif.


Comment obtenir les variables smarty disponibles dans un module? - jissey - 19/06/2017

Bonjour,
Perso je recherche "assign" dans les fichiers php du dossier du module :/
Il y a aussi get_template_var et je fais aussi des print_r sur les variables de type object ou tableau.
Bref, je vais à la pêche en somme!


Comment obtenir les variables smarty disponibles dans un module? - archeo - 19/06/2017

Je pensais naïvement trouver ça dans le répertoire doc du module... :mad: .
Ce ne serait peut-être pas inintéressant de mutualiser les infos?


Comment obtenir les variables smarty disponibles dans un module? - jissey - 20/06/2017

voici un extrait d'une recherche dans le module News...c'est déjà une piste...reste à analyser...

Notepad++ a écrit :Search "assign" (330 hits in 18 files)
C:\wamp64\www\Site_sett_2.2\modules\News\action.addarticle.php (59 hits)
Line 352: $smarty->assign('formid', $id);
Line 353: $smarty->assign('hide_summary_field', $this->GetPreference('hide_summary_field', '0'));
Line 354: $smarty->assign('authortext', '');
Line 355: $smarty->assign('inputauthor', '');
Line 356: $smarty->assign('startform', $this->CreateFormStart($id, 'addarticle', $returnid, 'post', 'multipart/form-data'));
Line 357: $smarty->assign('endform', $this->CreateFormEnd());
Line 358: $smarty->assign('titletext', $this->Lang('title'));
Line 359: $smarty->assign('title', $title);
Line 360: $smarty->assign('allow_summary_wysiwyg', $this->GetPreference('allow_summary_wysiwyg'));
Line 361: $smarty->assign('extratext', $this->Lang('extra'));
Line 362: $smarty->assign('extra', $extra);
Line 363: $smarty->assign('urltext', $this->Lang('url'));
Line 364: $smarty->assign('news_url', $news_url);
Line 365: $smarty->assign('postdate', $postdate);
Line 366: $smarty->assign('postdateprefix', $id . 'postdate_');
Line 367: $smarty->assign('useexp', $useexp);
Line 368: $smarty->assign('actionid', $id);
Line 369: $smarty->assign('inputexp', $this->CreateInputCheckbox($id, 'useexp', '1', $useexp, 'class="pagecheckbox"'));
Line 370: $smarty->assign('startdate', $startdate);
Line 371: $smarty->assign('startdateprefix', $id . 'startdate_');
Line 372: $smarty->assign('enddate', $enddate);
Line 373: $smarty->assign('enddateprefix', $id . 'enddate_');
Line 374: $smarty->assign('status', $status);
Line 375: $smarty->assign('categorylist', array_flip($categorylist));
Line 376: $smarty->assign('category', $usedcategory);
Line 377: $smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', lang('submit')));
Line 378: $smarty->assign('cancel', $this->CreateInputSubmit($id, 'cancel', lang('cancel')));
Line 379: $smarty->assign('delete_field_val', $this->Lang('delete'));
Line 380: $smarty->assign('titletext', $this->Lang('title'));
Line 381: $smarty->assign('categorytext', $this->Lang('category'));
Line 382: $smarty->assign('summarytext', $this->Lang('summary'));
Line 383: $smarty->assign('contenttext', $this->Lang('content'));
Line 384: $smarty->assign('postdatetext', $this->Lang('postdate'));
Line 385: $smarty->assign('useexpirationtext', $this->Lang('useexpiration'));
Line 386: $smarty->assign('startdatetext', $this->Lang('startdate'));
Line 387: $smarty->assign('enddatetext', $this->Lang('enddate'));
Line 388: $smarty->assign('searchable', $searchable);
Line 389: $smarty->assign('select_option', $this->Lang('select_option'));
Line 391: $smarty->assign('start_tab_headers', $this->StartTabHeaders());
Line 392: $smarty->assign('tabheader_article', $this->SetTabHeader('article', $this->Lang('article')));
Line 393: $smarty->assign('tabheader_preview', $this->SetTabHeader('preview', $this->Lang('preview')));
Line 394: $smarty->assign('end_tab_headers', $this->EndTabHeaders());
Line 395: $smarty->assign('start_tab_content', $this->StartTabContent());
Line 396: $smarty->assign('start_tab_article', $this->StartTab('article', $params));
Line 397: $smarty->assign('end_tab_article', $this->EndTab());
Line 398: $smarty->assign('end_tab_content', $this->EndTabContent());
Line 399: $smarty->assign('warning_preview', $this->Lang('warning_preview'));
Line 408: $smarty->assign('inputcontent', CmsFormUtils::create_textarea($parms));
Line 417: $smarty->assign('inputsummary', CmsFormutils::create_textarea($parms));
Line 420: $smarty->assign('custom_fields', $custom_flds);
Line 423: $smarty->assign('statustext', lang('status'));
Line 424: $smarty->assign('statuses', array_flip($statusdropdown));
Line 428: $smarty->assign('preview_returnid', $contentops->CreateHierarchyDropdown('', $this->GetPreference('detail_returnid', -1), 'preview_returnid'));
Line 441: $smarty->assign('prompt_detail_template', $this->Lang('detail_template'));
Line 442: $smarty->assign('prompt_detail_page', $this->Lang('detail_page'));
Line 443: $smarty->assign('detail_templates', $list);
Line 444: $smarty->assign('cur_detail_template', $this->GetPreference('current_detail_template'));
Line 445: $smarty->assign('start_tab_preview', $this->StartTab('preview', $params));
Line 446: $smarty->assign('end_tab_preview', $this->EndTab());
C:\wamp64\www\Site_sett_2.2\modules\News\action.addcategory.php (9 hits)
Line 52: $smarty->assign('parent',$parent);
Line 53: $smarty->assign('name',$name);
Line 54: $smarty->assign('categories',$categories);
Line 55: $smarty->assign('startform', $this->CreateFormStart($id, 'addcategory', $returnid));
Line 56: $smarty->assign('endform', $this->CreateFormEnd());
Line 57: $smarty->assign('inputname', $this->CreateInputText($id, 'name', $name, 20, 255));
Line 58: $smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', lang('submit')));
Line 59: $smarty->assign('cancel', $this->CreateInputSubmit($id, 'cancel', lang('cancel')));
Line 60: $smarty->assign('mod',$this);
C:\wamp64\www\Site_sett_2.2\modules\News\action.admin_addfielddef.php (16 hits)
Line 66: $smarty->assign('title',$this->Lang('addfielddef'));
Line 67: $smarty->assign('startform', $this->CreateFormStart($id, 'admin_addfielddef', $returnid));
Line 68: $smarty->assign('endform', $this->CreateFormEnd());
Line 69: $smarty->assign('nametext', $this->Lang('name'));
Line 70: $smarty->assign('typetext', $this->Lang('type'));
Line 71: $smarty->assign('maxlengthtext', $this->Lang('maxlength'));
Line 72: $smarty->assign('showinputtype', true);
Line 73: $smarty->assign('info_maxlength', $this->Lang('info_maxlength'));
Line 74: $smarty->assign('userviewtext',$this->Lang('public'));
Line 76: $smarty->assign('name',$name);
Line 77: $smarty->assign('fieldtypes',$this->GetFieldTypes());
Line 78: $smarty->assign('type',$type);
Line 79: $smarty->assign('max_length',$max_length);
Line 80: $smarty->assign('public',$public);
Line 81: $smarty->assign('options',$options);
Line 83: $smarty->assign('mod',$this);
C:\wamp64\www\Site_sett_2.2\modules\News\action.admin_editfielddef.php (18 hits)
Line 90: $smarty->assign('title',$this->Lang('editfielddef'));
Line 91: $smarty->assign('startform', $this->CreateFormStart($id, 'admin_editfielddef', $returnid));
Line 92: $smarty->assign('endform', $this->CreateFormEnd());
Line 93: $smarty->assign('nametext', $this->Lang('name'));
Line 94: $smarty->assign('typetext', $this->Lang('type'));
Line 95: $smarty->assign('maxlengthtext', $this->Lang('maxlength'));
Line 96: $smarty->assign('showinputtype', false);
Line 97: $smarty->assign('inputtype', $this->CreateInputHidden($id, 'type', $type));
Line 98: $smarty->assign('info_maxlength', $this->Lang('info_maxlength'));
Line 99: $smarty->assign('userviewtext',$this->Lang('public'));
Line 101: $smarty->assign('name',$name);
Line 102: $smarty->assign('fieldtypes',$this->GetFieldTypes());
Line 103: $smarty->assign('type',$type);
Line 104: $smarty->assign('max_length',$max_length);
Line 105: $smarty->assign('public',$public);
Line 106: $smarty->assign('options',$options);
Line 108: $smarty->assign('mod',$this);
Line 109: $smarty->assign('hidden',
C:\wamp64\www\Site_sett_2.2\modules\News\action.admin_reorder_cats.php (1 hit)
Line 51: $smarty->assign('allcats',$allcats);
C:\wamp64\www\Site_sett_2.2\modules\News\action.browsecat.php (2 hits)
Line 23: $tpl_ob->assign('count', count($items));
Line 24: $tpl_ob->assign('cats', $items);
C:\wamp64\www\Site_sett_2.2\modules\News\action.default.php (25 hits)
Line 184: // Assign some pagination variables to smarty
Line 186: $tpl_ob->assign('prevpage',$this->Lang('prevpage'));
Line 187: $tpl_ob->assign('firstpage',$this->Lang('firstpage'));
Line 191: $tpl_ob->assign('prevpage',$this->CreateFrontendLink($id,$returnid,'default',$this->Lang('prevpage'),$params));
Line 192: $tpl_ob->assign('prevurl',$this->CreateFrontendLink($id,$returnid,'default','',$params, '', true));
Line 194: $tpl_ob->assign('firstpage',$this->CreateFrontendLink($id,$returnid,'default',$this->Lang('firstpage'),$params));
Line 195: $tpl_ob->assign('firsturl',$this->CreateFrontendLink($id,$returnid,'default','',$params, '', true));
Line 199: $tpl_ob->assign('nextpage',$this->Lang('nextpage'));
Line 200: $tpl_ob->assign('lastpage',$this->Lang('lastpage'));
Line 204: $tpl_ob->assign('nextpage',$this->CreateFrontendLink($id,$returnid,'default',$this->Lang('nextpage'),$params));
Line 205: $tpl_ob->assign('nexturl',$this->CreateFrontendLink($id,$returnid,'default','',$params, '', true));
Line 207: $tpl_ob->assign('lastpage',$this->CreateFrontendLink($id,$returnid,'default',$this->Lang('lastpage'),$params));
Line 208: $tpl_ob->assign('lasturl',$this->CreateFrontendLink($id,$returnid,'default','',$params, '', true));
Line 210: $tpl_ob->assign('pagenumber',$pagenumber);
Line 211: $tpl_ob->assign('pagecount',$pagecount);
Line 212: $tpl_ob->assign('oftext',$this->Lang('prompt_of'));
Line 213: $tpl_ob->assign('pagetext',$this->Lang('prompt_page'));
Line 296: $tpl_ob->assign('itemcount', count($entryarray));
Line 297: $tpl_ob->assign('items', $entryarray);
Line 298: $tpl_ob->assign('category_label', $this->Lang('category_label'));
Line 299: $tpl_ob->assign('author_label', $this->Lang('author_label'));
Line 303: $tpl_ob->assign('param_'.$key,$value);
Line 324: $tpl_ob->assign('category_name',$catName);
Line 326: $tpl_ob->assign('count', count($items));
Line 327: $tpl_ob->assign('cats', $items);
C:\wamp64\www\Site_sett_2.2\modules\News\action.detail.php (7 hits)
Line 63: $tpl_ob->assign('return_url', $return_url);
Line 64: $tpl_ob->assign('entry', $article);
Line 70: $tpl_ob->assign('category_name',$catName);
Line 72: $tpl_ob->assign('category_link',$this->CreateLink($id, 'default', $returnid, $catName, $params));
Line 74: $tpl_ob->assign('category_label', $this->Lang('category_label'));
Line 75: $tpl_ob->assign('author_label', $this->Lang('author_label'));
Line 76: $tpl_ob->assign('extra_label', $this->Lang('extra_label'));



Comment obtenir les variables smarty disponibles dans un module? - airelibre - 20/06/2017

Code :
{get_template_vars}
te donnera un bon début, puis
Code :
<pre>{$var|print_r}</pre>



Comment obtenir les variables smarty disponibles dans un module? - archeo - 20/06/2017

Sacrés ouvre boîtes tes deux méthodes airelibre Rolleyes Rolleyes