Dotclear

Changeset 3366:1627515406c9


Ignore:
Timestamp:
10/26/16 16:19:15 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add new categories attribute to EntryIf? template tag, closes #2199

Ex:

  • categories="!Plugin,!Theme" → valid if entry's category is not Plugin nor Theme
  • categories="Plugin,Theme" operator="or" → valid if entry's category is Plugin or Theme
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/public/class.dc.template.php

    r3259 r3366  
    12671267     type CDATA     #IMPLIED  -- post has a given type (default: "post") 
    12681268     category  CDATA     #IMPLIED  -- post has a given category 
     1269     categories     CDATA     #IMPLIED  -- post has a one of given categories 
    12691270     first     (0|1)     #IMPLIED  -- post is the first post from list (value : 1) or not (value : 0) 
    12701271     odd  (0|1)     #IMPLIED  -- post is in an odd position (value : 1) or not (value : 0) 
     
    13171318          } 
    13181319 
     1320          if (isset($attr['categories'])) { 
     1321               $categories = explode(',',addslashes(trim($attr['categories']))); 
     1322               if (is_array($categories) && count($categories)) { 
     1323                    foreach ($categories as $category) { 
     1324                         if (substr($category,0,1) == '!') { 
     1325                              $category = substr($category,1); 
     1326                              $if[] = '($_ctx->posts->cat_url != "'.$category.'")'; 
     1327                         } else { 
     1328                              $if[] = '($_ctx->posts->cat_url == "'.$category.'")'; 
     1329                         } 
     1330                    } 
     1331               } 
     1332          } 
     1333 
    13191334          if (isset($attr['first'])) { 
    13201335               $sign = (boolean) $attr['first'] ? '=' : '!'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map