Changeset 583:c7f81168aa22 for themes/ductile
- Timestamp:
- 07/13/11 07:28:49 (14 years ago)
- Branch:
- themes
- Location:
- themes/ductile
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_config.php
r572 r583 143 143 } 144 144 145 $ductile_counts_base = array( 146 'default' => null, 147 'category' => null, 148 'tag' => null, 149 'search' => null 150 ); 151 152 $ductile_counts = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts'); 153 $ductile_counts = @unserialize($ductile_counts); 154 if (!is_array($ductile_counts)) { 155 $ductile_counts = $ductile_counts_base; 156 } 157 158 145 159 $conf_tab = isset($_POST['conf_tab']) ? $_POST['conf_tab'] : 'html'; 146 160 … … 182 196 } 183 197 198 for ($i = 0; $i < count($_POST['count_nb']); $i++) { 199 $ductile_counts[$_POST['count_ctx'][$i]] = $_POST['count_nb'][$i]; 200 } 201 184 202 } 185 203 … … 216 234 $core->blog->settings->themes->put($core->blog->settings->system->theme.'_stickers',serialize($ductile_stickers)); 217 235 $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_lists',serialize($ductile_lists)); 236 $core->blog->settings->themes->put($core->blog->settings->system->theme.'_entries_counts',serialize($ductile_counts)); 218 237 219 238 // Blog refresh … … 283 302 echo '</fieldset>'; 284 303 285 echo '<fieldset><legend>'.__('Entries list types ').'</legend>';304 echo '<fieldset><legend>'.__('Entries list types and limits').'</legend>'; 286 305 287 306 echo '<table id="entrieslist">'.'<caption>'.__('Entries lists').'</caption>'. … … 290 309 '<th scope="col">'.__('Context').'</th>'. 291 310 '<th scope="col">'.__('Entries list type').'</th>'. 311 '<th scope="col">'.__('Number of entries').'</th>'. 292 312 '</tr>'. 293 313 '</thead>'. … … 297 317 '<tr>'. 298 318 '<td scope="raw">'.$contexts[$k].'</td>'. 299 '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>'. 319 '<td>'.form::hidden(array('list_ctx[]'),$k).form::combo(array('list_type[]'),$list_types,$v).'</td>'; 320 if (array_key_exists($k,$ductile_counts)) { 321 echo '<td>'.form::hidden(array('count_ctx[]'),$k).form::field(array('count_nb[]'),2,3,$ductile_counts[$k]).'</td>'; 322 } else { 323 echo '<td></td>'; 324 } 325 echo 300 326 '</tr>'; 301 327 } -
themes/ductile/_public.php
r574 r583 20 20 $core->tpl->addValue('ductileEntriesList',array('tplDuctileTheme','ductileEntriesList')); 21 21 $core->tpl->addBlock('EntryIfContentIsCut',array('tplDuctileTheme','EntryIfContentIsCut')); 22 $core->tpl->addValue('ductileNbEntryPerPage',array('tplDuctileTheme','ductileNbEntryPerPage')); 22 23 23 24 class tplDuctileTheme 24 25 { 26 public static function ductileNbEntryPerPage($attr) 27 { 28 global $core; 29 30 $nb = 0; 31 $s = $core->blog->settings->themes->get($core->blog->settings->system->theme.'_entries_counts'); 32 if ($s !== null) { 33 $s = @unserialize($s); 34 if (is_array($s)) { 35 if (isset($s[$core->url->type])) { 36 // Nb de billets par page défini par la config du thème 37 $nb = (integer) $s[$core->url->type]; 38 } else { 39 if (($core->url->type == 'default-page') && (isset($s['default']))) { 40 // Les pages 2 et suivantes de la home ont le même nombre de billet que la première page 41 $nb = (integer) $s['default']; 42 } 43 } 44 } 45 } 46 47 if ($nb == 0) { 48 if (!empty($attr['nb'])) { 49 // Nb de billets par page défini par défaut dans le template 50 $nb = (integer) $attr['nb']; 51 } 52 } 53 54 if ($nb > 0) 55 return '<?php $_ctx->nb_entry_per_page = '.$nb.' ; ?>'; 56 } 57 25 58 public static function EntryIfContentIsCut($attr,$content) 26 59 { 27 60 global $core; 28 61 29 if (empty($attr['cut_string']) || empty($attr[' cut_string'])) {62 if (empty($attr['cut_string']) || empty($attr['full'])) { 30 63 return ''; 31 64 } -
themes/ductile/tpl/category.html
r563 r583 25 25 <link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" /> 26 26 27 {{tpl:ductileNbEntryPerPage}} 27 28 <tpl:Entries no_content="1"> 28 29 <tpl:EntriesHeader> … … 85 86 </div> 86 87 88 {{tpl:ductileNbEntryPerPage}} 87 89 <tpl:Entries> 88 89 90 {{tpl:ductileEntriesList default="short"}} 90 91 -
themes/ductile/tpl/home.html
r563 r583 27 27 </tpl:Categories> 28 28 29 {{tpl:ductileNbEntryPerPage nb="8"}} 29 30 <tpl:Entries no_content="1"> 30 31 <tpl:EntriesHeader> … … 59 60 <div id="content"> 60 61 62 {{tpl:ductileNbEntryPerPage nb="8"}} 61 63 <tpl:Entries> 62 64 -
themes/ductile/tpl/search.html
r563 r583 23 23 <link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" /> 24 24 25 {{tpl:ductileNbEntryPerPage}} 25 26 <tpl:Entries no_content="1"> 26 27 <tpl:EntriesHeader> … … 66 67 </div> 67 68 69 {{tpl:ductileNbEntryPerPage}} 68 70 <tpl:Entries> 69 71
Note: See TracChangeset
for help on using the changeset viewer.