Dotclear


Ignore:
Timestamp:
02/07/14 14:35:17 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Children:
2656:95fe4eacc716, 2657:264ffd49d238
Message:

Add post-current class (if necessary) in bestof and lastposts widgets, addresses #1908

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/_widgets_functions.php

    r2605 r2653  
    125125     public static function bestof($w) 
    126126     { 
    127           global $core; 
     127          global $core, $_ctx; 
    128128 
    129129          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     
    150150 
    151151          while ($rs->fetch()) { 
    152                $res .= ' <li><a href="'.$rs->getURL().'">'.html::escapeHTML($rs->post_title).'</a></li> '; 
     152               $class = ''; 
     153               if ($core->url->type == 'post' && $_ctx->posts instanceof record && $_ctx->posts->post_id == $rs->post_id) { 
     154                    $class = ' class="post-current"'; 
     155               } 
     156               $res .= ' <li'.$class.'><a href="'.$rs->getURL().'">'.html::escapeHTML($rs->post_title).'</a></li> '; 
    153157          } 
    154158 
     
    314318     public static function lastposts($w) 
    315319     { 
    316           global $core; 
     320          global $core, $_ctx; 
    317321 
    318322          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     
    356360 
    357361          while ($rs->fetch()) { 
    358                $res .= '<li><a href="'.$rs->getURL().'">'. 
     362               $class = ''; 
     363               if ($core->url->type == 'post' && $_ctx->posts instanceof record && $_ctx->posts->post_id == $rs->post_id) { 
     364                    $class = ' class="post-current"'; 
     365               } 
     366               $res .= '<li'.$class.'><a href="'.$rs->getURL().'">'. 
    359367               html::escapeHTML($rs->post_title).'</a></li>'; 
    360368          } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map