Changeset 2231 for trunk/include


Ignore:
Timestamp:
Mar 1, 2008, 2:12:07 PM (16 years ago)
Author:
rvelices
Message:
  • index.tpl, menubar.tpl, mainpage_categories.tpl and month_calendar.tpl go smarty
  • better template debugging tweak (the smarty console is shown only once at the end)
Location:
trunk/include
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_base.class.php

    r2101 r2231  
    22// +-----------------------------------------------------------------------+
    33// | PhpWebGallery - a PHP based picture gallery                           |
    4 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     4// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    66// | file          : $Id$
     
    3636  var $calendar_levels;
    3737
    38   var $has_nav_bar;
    39 
    4038  /**
    4139   * Initialize the calendar
     
    5452    }
    5553    $this->inner_sql = $inner_sql;
    56     $this->has_nav_bar = false;
    5754  }
    5855
     
    263260      );
    264261
    265     $template->assign_block_vars(
    266       'calendar.navbar',
     262    $template->append(
     263      'chronology_navigation_bars',
    267264      array(
    268         'BAR' => $nav_bar,
     265        'CONTENT' => $nav_bar,
    269266        )
    270267      );
    271     $this->has_nav_bar = true;
    272268  }
    273269
     
    312308    $current_rank = $upper_items_rank[$current];
    313309
    314     if (!$this->has_nav_bar and
    315         ($current_rank>0 or $current_rank < count($upper_items)-1 ) )
    316     {
    317       $template->assign_block_vars( 'calendar.navbar', array() );
    318     }
    319 
     310    $tpl_var = array();
     311   
    320312    if ( $current_rank>0 )
    321313    { // has previous
    322314      $prev = $upper_items[$current_rank-1];
    323315      $chronology_date = explode('-', $prev);
    324       $template->assign_block_vars(
    325         'calendar.navbar.prev',
     316      $tpl_var['previous'] =
    326317        array(
    327318          'LABEL' => $this->get_date_nice_name($prev),
     
    329320                array('chronology_date'=>$chronology_date), array('start')
    330321                )
    331           )
    332322        );
    333323    }
     324   
    334325    if ( $current_rank < count($upper_items)-1 )
    335326    { // has next
    336327      $next = $upper_items[$current_rank+1];
    337328      $chronology_date = explode('-', $next);
    338       $template->assign_block_vars(
    339         'calendar.navbar.next',
     329      $tpl_var['next'] =
    340330        array(
    341331          'LABEL' => $this->get_date_nice_name($next),
     
    343333                array('chronology_date'=>$chronology_date), array('start')
    344334                )
    345           )
    346335        );
     336    }
     337   
     338    if ( !empty($tpl_var) )
     339    {
     340      $existing = & $template->get_template_vars('chronology_navigation_bars');
     341      if ( !empty($existing) )
     342      {
     343        $existing[ sizeof($existing)-1 ] =
     344          array_merge( $existing[ sizeof($existing)-1 ], $tpl_var);
     345      }
     346      else
     347      {
     348        $template->append( 'chronology_navigation_bars', $tpl_var );
     349      }
    347350    }
    348351  }
  • trunk/include/calendar_monthly.class.php

    r2101 r2231  
    7272  if ($view_type==CAL_VIEW_CALENDAR)
    7373  {
     74    global $template;
     75    $tpl_var = array();
    7476    if ( count($page['chronology_date'])==0 )
    7577    {//case A: no year given - display all years+months
    76       if ($this->build_global_calendar())
     78      if ($this->build_global_calendar($tpl_var))
     79      {
     80        $template->assign('chronology_calendar', $tpl_var);
    7781        return true;
     82      }
    7883    }
    7984
    8085    if ( count($page['chronology_date'])==1 )
    8186    {//case B: year given - display all days in given year
    82       if ($this->build_year_calendar())
    83       {
     87      if ($this->build_year_calendar($tpl_var))
     88      {
     89        $template->assign('chronology_calendar', $tpl_var);
    8490        $this->build_nav_bar(CYEAR); // years
    8591        return true;
     
    8995    if ( count($page['chronology_date'])==2 )
    9096    {//case C: year+month given - display a nice month calendar
    91       $this->build_month_calendar();
    92       //$this->build_nav_bar(CYEAR); // years
    93       //$this->build_nav_bar(CMONTH); // month
     97      if ( $this->build_month_calendar($tpl_var) )
     98      {
     99        $template->assign('chronology_calendar', $tpl_var);
     100      }
    94101      $this->build_next_prev();
    95102      return true;
     
    99106  if ($view_type==CAL_VIEW_LIST or count($page['chronology_date'])==3)
    100107  {
    101     $has_nav_bar = false;
    102108    if ( count($page['chronology_date'])==0 )
    103109    {
     
    214220}
    215221
    216 function build_global_calendar()
     222function build_global_calendar(&$tpl_var)
    217223{
    218224  global $page;
     
    247253  }
    248254
    249   global $lang, $template;
     255  global $lang;
    250256  foreach ( $items as $year=>$year_data)
    251257  {
     
    253259    $url = duplicate_index_url( array('chronology_date'=>$chronology_date) );
    254260
    255     $nav_bar = '<span class="calCalHead"><a href="'.$url.'">'.$year.'</a>';
    256     $nav_bar .= ' ('.$year_data['nb_images'].')';
    257     $nav_bar .= '</span><br>';
    258 
    259     $nav_bar .= $this->get_nav_bar_from_items( $chronology_date,
     261    $nav_bar = $this->get_nav_bar_from_items( $chronology_date,
    260262            $year_data['children'], 'calCal', false, false, $lang['month'] );
    261263
    262     $template->assign_block_vars( 'calendar.calbar',
    263          array( 'BAR' => $nav_bar)
    264          );
     264    $tpl_var['calendar_bars'][] =
     265      array(
     266        'U_HEAD'  => $url,
     267        'NB_IMAGES' => $year_data['nb_images'],
     268        'HEAD_LABEL' => $year,
     269        'NAV_BAR' => $nav_bar,
     270      );
    265271  }
    266272  return true;
    267273}
    268274
    269 function build_year_calendar()
     275function build_year_calendar(&$tpl_var)
    270276{
    271277  global $page;
     
    297303    return false;
    298304  }
    299   global $lang, $template;
     305  global $lang;
    300306  foreach ( $items as $month=>$month_data)
    301307  {
     
    303309    $url = duplicate_index_url( array('chronology_date'=>$chronology_date) );
    304310
    305     $nav_bar = '<span class="calCalHead"><a href="'.$url.'">';
    306     $nav_bar .= $lang['month'][$month].'</a>';
    307     $nav_bar .= ' ('.$month_data['nb_images'].')';
    308     $nav_bar .= '</span><br>';
    309 
    310     $nav_bar .= $this->get_nav_bar_from_items( $chronology_date,
     311    $nav_bar = $this->get_nav_bar_from_items( $chronology_date,
    311312                     $month_data['children'], 'calCal', false );
    312313
    313     $template->assign_block_vars( 'calendar.calbar',
    314          array( 'BAR' => $nav_bar)
    315          );
     314    $tpl_var['calendar_bars'][] =
     315      array(
     316        'U_HEAD'  => $url,
     317        'NB_IMAGES' => $month_data['nb_images'],
     318        'HEAD_LABEL' => $lang['month'][$month],
     319        'NAV_BAR' => $nav_bar,
     320      );
    316321  }
    317322  return true;
     
    319324}
    320325
    321 function build_month_calendar()
     326function build_month_calendar(&$tpl_var)
    322327{
    323328  global $page;
     
    359364  }
    360365
    361   global $lang, $template, $conf;
     366  global $lang, $conf;
    362367
    363368  if ( !empty($items)
     
    390395    $cell_height = $conf['calendar_month_cell_height'];
    391396
    392     $template->set_filenames(
    393       array(
    394         'month_calendar'=>'month_calendar.tpl',
    395         )
    396       );
    397 
    398     $template->assign_block_vars('calendar.thumbnails',
    399         array(
    400            'WIDTH'=>$cell_width,
    401            'HEIGHT'=>$cell_height,
    402           )
    403       );
    404 
    405     //fill the heading with day names
    406     $template->assign_block_vars('calendar.thumbnails.head', array());
    407     foreach( $wday_labels as $d => $label)
    408     {
    409       $template->assign_block_vars('calendar.thumbnails.head.col',
    410                     array('LABEL'=>$label)
    411                   );
    412     }
    413 
    414     $template->assign_block_vars('calendar.thumbnails.row', array());
     397    $tpl_weeks    = array();
     398    $tpl_crt_week = array();
    415399
    416400    //fill the empty days in the week before first day of this month
    417401    for ($i=0; $i<$first_day_dow; $i++)
    418402    {
    419       $template->assign_block_vars('calendar.thumbnails.row.col', array());
    420       $template->assign_block_vars('calendar.thumbnails.row.col.blank', array());
    421     }
     403      $tpl_crt_week[] = array();
     404    }
     405
    422406    for ( $day = 1;
    423407          $day <= $this->get_all_days_in_month(
     
    429413      if ($dow==0 and $day!=1)
    430414      {
    431         $template->assign_block_vars('calendar.thumbnails.row', array());
    432       }
    433       $template->assign_block_vars('calendar.thumbnails.row.col', array());
     415        $tpl_weeks[]    = $tpl_crt_week; // add finished week to week list
     416        $tpl_crt_week   = array(); // start new week
     417      }
     418
    434419      if ( !isset($items[$day]) )
    435       {
    436         $template->assign_block_vars('calendar.thumbnails.row.col.empty',
    437               array('LABEL'=>$day));
     420      {// empty day
     421        $tpl_crt_week[]   =
     422          array(
     423              'DAY' => $day
     424            );
    438425      }
    439426      else
    440427      {
    441 /*        // first try to guess thumbnail size
    442         if ( !empty($items[$day]['width']) )
    443         {
    444           $tn_size = get_picture_size(
    445                  $items[$day]['width'], $items[$day]['height'],
    446                  $conf['tn_width'], $conf['tn_height'] );
    447         }
    448         else*/
    449         {// item not an image (tn is either mime type or an image)
    450           $thumb = get_thumbnail_path($items[$day]);
    451           $tn_size = @getimagesize($thumb);
    452         }
     428        $thumb = get_thumbnail_path($items[$day]);
     429        $tn_size = @getimagesize($thumb);
     430
    453431        $tn_width = $tn_size[0];
    454432        $tn_height = $tn_size[1];
     
    460438        $ratio_h = $tn_height/$cell_height;
    461439
    462 
    463440        $pos_top=$pos_left=0;
    464         $img_width=$img_height='';
     441        $css_style = '';
     442
    465443        if ( $ratio_w>1 and $ratio_h>1)
    466444        {// cell completely smaller than the thumbnail so we will let the browser
     
    468446          if ($ratio_w > $ratio_h )
    469447          {// thumbnail ratio compared to cell -> wide format
    470             $img_height = 'height="'.$cell_height.'"';
     448            $css_style = 'height:'.$cell_height.'px;';
    471449            $browser_img_width = $cell_height*$tn_width/$tn_height;
    472450            $pos_left = ($browser_img_width-$cell_width)/2;
     
    474452          else
    475453          {
    476             $img_width = 'width="'.$cell_width.'"';
     454            $css_style = 'width:'.$cell_width.'px;';
    477455            $browser_img_height = $cell_width*$tn_height/$tn_width;
    478456            $pos_top = ($browser_img_height-$cell_height)/2;
     
    485463        }
    486464
    487         $css_style = '';
    488465        if ( round($pos_left)!=0)
    489466        {
     
    506483        $alt = $wday_labels[$dow] . ' ' . $day.
    507484               ' ('.sprintf("%d ".l10n('pictures'), $items[$day]['nb_images']).')';
    508         $template->assign_block_vars('calendar.thumbnails.row.col.full',
    509               array(
    510                 'LABEL'     => $day,
    511                 'IMAGE'     => $items[$day]['tn_url'],
    512                 'U_IMG_LINK'=> $url,
    513                 'STYLE'     => $css_style,
    514                 'IMG_WIDTH' => $img_width,
    515                 'IMG_HEIGHT'=> $img_height,
    516                 'IMAGE_ALT' => $alt,
    517               )
     485
     486        $tpl_crt_week[]   =
     487          array(
     488              'DAY' => $day,
     489              'IMAGE'     => $items[$day]['tn_url'],
     490              'U_IMG_LINK'=> $url,
     491              'IMAGE_STYLE'     => $css_style,
     492              'IMAGE_ALT' => $alt,
    518493            );
    519494      }
     
    522497    while ( $dow<6 )
    523498    {
    524       $template->assign_block_vars('calendar.thumbnails.row.col', array());
    525       $template->assign_block_vars('calendar.thumbnails.row.col.blank', array());
     499      $tpl_crt_week[] = array();
    526500      $dow++;
    527501    }
    528     $template->assign_var_from_handle('MONTH_CALENDAR', 'month_calendar');
    529   }
    530   else
    531   {
    532     $template->assign_block_vars('thumbnails', array());
    533     $template->assign_block_vars('thumbnails.line', array());
    534     foreach ( $items as $day=>$data)
    535     {
    536       $url = duplicate_index_url(
    537           array(
    538             'chronology_date' =>
    539               array(
    540                 $page['chronology_date'][CYEAR],
    541                 $page['chronology_date'][CMONTH],
    542                 $day
    543               )
    544           )
    545         );
    546 
    547       $thumbnail_title = $lang['day'][$data['dow']] . ' ' . $day;
    548       $name = $thumbnail_title .' ('.$data['nb_images'].')';
    549 
    550       $template->assign_block_vars(
    551           'thumbnails.line.thumbnail',
    552           array(
    553             'IMAGE'=>$data['tn_url'],
    554             'IMAGE_ALT'=>$data['file'],
    555             'IMAGE_TITLE'=>$thumbnail_title,
    556             'U_IMG_LINK'=>$url
    557            )
     502    $tpl_weeks[]    = $tpl_crt_week;
     503
     504    $tpl_var['month_view'] =
     505        array(
     506           'CELL_WIDTH'   => $cell_width,
     507           'CELL_HEIGHT' => $cell_height,
     508           'wday_labels' => $wday_labels,
     509           'weeks' => $tpl_weeks,
    558510          );
    559       $template->assign_block_vars(
    560           'thumbnails.line.thumbnail.category_name',
    561           array(
    562             'NAME' => $name
    563             )
    564           );
    565     }
    566511  }
    567512
  • trunk/include/category_cats.inc.php

    r2201 r2231  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | file          : $Id$
     
    234234      $icon_ts = get_icon($category['max_date_last'], $category['is_child_date_last']);
    235235
    236       $template->assign_block_vars(
    237         'categories.category',
     236      $tpl_var =
    238237        array(
    239           'SRC'   => $thumbnail_src_of[$category['representative_picture_id']],
     238          'ID'    => $category['id'],
     239          'TN_SRC'   => $thumbnail_src_of[$category['representative_picture_id']],
    240240          'ALT'   => $category['name'],
    241           'TITLE' => l10n('hint_category'),
    242241          'ICON'  => $icon_ts,
    243242
     
    261260                'subcatify_category_description')),
    262261          'NAME'  => $name,
    263           )
    264         );
     262          );
    265263
    266264      if ($conf['display_fromto'])
     
    287285                );
    288286            }
    289 
    290             $template->assign_block_vars(
    291               'categories.category.dates',
    292               array(
    293                 'INFO' => $info,
    294                 )
    295               );
     287            $tpl_var['INFO_DATES'] = $info;
    296288          }
    297289        }
    298       }
     290      }//fromto
     291     
     292      $template->append( 'category_thumbnails', $tpl_var);
     293
    299294
    300295      //plugins need to add/modify sth in this loop ?
  • trunk/include/functions_calendar.inc.php

    r1900 r2231  
    201201      $must_show_list = false;
    202202    }
     203   
     204    $page['comment'] = '';
     205    $template->assign('FILE_CHRONOLOGY_VIEW', 'month_calendar.tpl');
    203206
    204207    foreach ($styles as $style => $style_data)
     
    208211        if ( $style_data['view_calendar'] or $view != CAL_VIEW_CALENDAR)
    209212        {
    210           $selected = '';
     213          $selected = false;
    211214
    212215          if ($style!=$cal_style)
     
    232235          if ($style==$cal_style and $view==$page['chronology_view'] )
    233236          {
    234             $selected = 'SELECTED';
     237            $selected = true;
    235238          }
    236239
    237           $template->assign_block_vars(
    238             'calendar.views.view',
     240          $template->append(
     241            'chronology_views',
    239242            array(
    240243              'VALUE' => $url,
     
    252255        .$fields[$page['chronology_field']]['label'].'</a>';
    253256    $calendar_title.= $calendar->get_display_name();
    254     $template->merge_block_vars('calendar',
     257    $template->assign('chronology',
    255258        array(
    256259          'TITLE' => $calendar_title
  • trunk/include/menubar.inc.php

    r2201 r2231  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | file          : $Id$
     
    3737trigger_action('loc_begin_menubar');
    3838
    39 $template->assign_vars(
     39$template->assign(
    4040  array(
    4141    'NB_PICTURE' => $user['nb_total_images'],
    42     'USERNAME' => $user['username'],
    4342    'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
    44     'F_IDENTIFY' => get_root_url().'identification.php',
    4543    'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
    46     'U_REGISTER' => get_root_url().'register.php',
    4744    'U_LOST_PASSWORD' => get_root_url().'password.php',
    48     'U_LOGOUT' => get_root_url().'?act=logout',
    49     'U_ADMIN'=> get_root_url().'admin.php',
    50     'U_PROFILE'=> get_root_url().'profile.php',
    5145    )
    5246  );
     
    6054  }
    6155
    62   if 
     56  if
    6357    (
    6458      (!isset($url_data['eval_visible']))
     
    6761    )
    6862  {
    69     $template->assign_block_vars(
    70       'links.link',
    71       array(
     63    $tpl_var = array(
    7264        'URL' => $url,
    7365        'LABEL' => $url_data['label']
    74         )
    7566      );
     67
    7668    if (!isset($url_data['new_window']) or $url_data['new_window'])
    7769    {
    78       $template->assign_block_vars(
    79         'links.link.new_window',
     70      $tpl_var['new_window'] =
    8071        array(
    81           'name' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
    82           'features' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
    83           )
     72          'NAME' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
     73          'FEATURES' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
    8474        );
    8575    }
     76    $template->append('links', $tpl_var);
    8677  }
    8778}
     
    9283  if ($filter['enabled'])
    9384  {
    94     $template->assign_block_vars(
    95       'stop_filter',
    96       array(
    97         'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop'))
    98         )
     85    $template->assign(
     86      'U_STOP_FILTER',
     87      add_url_params(make_index_url(array()), array('filter' => 'stop'))
    9988      );
    10089  }
    10190  else
    10291  {
    103     $template->assign_block_vars(
    104       'start_filter',
    105       array(
    106         'URL' => add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']))
    107         )
     92    $template->assign(
     93      'U_START_FILTER',
     94      add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']))
    10895      );
    10996  }
     
    11198
    11299//------------------------------------------------------------------------ tags
    113 if ('tags' == $page['section'])
     100if ('tags' == @$page['section'])
    114101{
    115102  // display tags associated to currently tagged items, less current tags
     
    125112  foreach ($tags as $tag)
    126113  {
    127     $template->assign_block_vars(
    128       'tags.tag',
     114    $template->append(
     115      'related_tags',
    129116      array(
    130         'URL' => make_index_url(
     117        'U_TAG' => make_index_url(
    131118          array(
    132119            'tags' => array($tag)
     
    136123        'NAME' => $tag['name'],
    137124
    138         'TITLE' => l10n('See pictures linked to this tag only'),
    139 
    140         'CLASS' => 'tagLevel'.$tag['level']
     125        'CLASS' => 'tagLevel'.$tag['level'],
     126
     127        'add' => array(
     128
     129            'URL' => make_index_url(
     130              array(
     131                'tags' => array_merge(
     132                  $page['tags'],
     133                  array($tag)
     134                  )
     135                )
     136              ),
     137            'COUNTER' => $tag['counter'],
     138            )
    141139        )
    142140      );
    143 
    144     $template->assign_block_vars(
    145       'tags.tag.add',
    146       array(
    147         'URL' => make_index_url(
    148           array(
    149             'tags' => array_merge(
    150               $page['tags'],
    151               array($tag)
    152               )
    153             )
    154           ),
    155         'TITLE' => l10n_dec(
    156             '%d picture are also linked to current tags',
    157             '%d pictures are also linked to current tags',
    158             $tag['counter']),
    159         )
    160       );
    161 
    162141  }
    163142}
     
    166145if ( !is_a_guest() )
    167146{
    168   $template->assign_block_vars('username', array());
    169 
    170   $template->assign_block_vars(
    171     'special_cat',
     147  $template->append(
     148    'special_categories',
    172149    array(
    173150      'URL' => make_index_url(array('section' => 'favorites')),
     
    177154}
    178155// most visited
    179 $template->assign_block_vars(
    180   'special_cat',
     156$template->append(
     157  'special_categories',
    181158  array(
    182159    'URL' => make_index_url(array('section' => 'most_visited')),
     
    187164if ($conf['rate'])
    188165{
    189   $template->assign_block_vars(
    190     'special_cat',
     166  $template->append(
     167    'special_categories',
    191168    array(
    192169      'URL' => make_index_url(array('section' => 'best_rated')),
     
    197174}
    198175// random
    199 $template->assign_block_vars(
    200   'special_cat',
     176$template->append(
     177  'special_categories',
    201178  array(
    202179    'URL' => get_root_url().'random.php',
     
    207184
    208185// recent pics
    209 $template->assign_block_vars(
    210   'special_cat',
     186$template->append(
     187  'special_categories',
    211188  array(
    212189    'URL' => make_index_url(array('section' => 'recent_pics')),
     
    215192    ));
    216193// recent cats
    217 $template->assign_block_vars(
    218   'special_cat',
     194$template->append(
     195  'special_categories',
    219196  array(
    220197    'URL' => make_index_url(array('section' => 'recent_cats')),
     
    224201
    225202// calendar
    226 $template->assign_block_vars(
    227   'special_cat',
     203$template->append(
     204  'special_categories',
    228205  array(
    229206    'URL' =>
     
    245222if (is_a_guest())
    246223{
    247   $template->assign_block_vars('login', array());
    248 
    249   $template->assign_block_vars('quickconnect', array());
    250   if ($conf['authorize_remembering'])
    251   {
    252     $template->assign_block_vars('quickconnect.remember_me', array());
    253   }
     224  $template->assign(
     225      array(
     226        'U_IDENTIFY' => get_root_url().'identification.php',
     227        'AUTHORIZE_REMEMBERING' => $conf['authorize_remembering']
     228      )
     229    );
     230
    254231  if ($conf['allow_user_registration'])
    255232  {
    256     $template->assign_block_vars('register', array());
    257     $template->assign_block_vars('quickconnect.register', array());
     233    $template->assign( 'U_REGISTER', get_root_url().'register.php');
    258234  }
    259235}
    260236else
    261237{
    262   $template->assign_block_vars('hello', array());
     238  $template->assign('USERNAME', $user['username']);
    263239
    264240  if (is_autorize_status(ACCESS_CLASSIC))
    265241  {
    266     $template->assign_block_vars('profile', array());
     242    $template->assign('U_PROFILE', get_root_url().'profile.php');
    267243  }
    268244
     
    271247  if (!$conf['apache_authentication'])
    272248  {
    273     $template->assign_block_vars('logout', array());
     249    $template->assign('U_LOGOUT', get_root_url().'?act=logout');
    274250  }
    275251
    276252  if (is_admin())
    277253  {
    278     $template->assign_block_vars('admin', array());
     254    $template->assign('U_ADMIN', get_root_url().'admin.php');
    279255  }
    280256}
    281257
    282258// tags link
    283 $template->assign_block_vars(
    284   'summary',
     259$template->append(
     260  'summaries',
    285261  array(
    286262    'TITLE' => l10n('See available tags'),
     
    291267
    292268// search link
    293 $template->assign_block_vars(
    294   'summary',
     269$template->append(
     270  'summaries',
    295271  array(
    296272    'TITLE'=>l10n('hint_search'),
     
    300276    )
    301277  );
    302 $template->assign_block_vars( 'summary.quick_search',  array() );
    303278
    304279// comments link
    305 $template->assign_block_vars(
    306   'summary',
     280$template->append(
     281  'summaries',
    307282  array(
    308283    'TITLE'=>l10n('hint_comments'),
     
    313288
    314289// about link
    315 $template->assign_block_vars(
    316   'summary',
     290$template->append(
     291  'summaries',
    317292  array(
    318293    'TITLE'     => l10n('about_page_title'),
     
    323298
    324299// notification
    325 $template->assign_block_vars(
    326   'summary',
     300$template->append(
     301  'summaries',
    327302  array(
    328303    'TITLE'=>l10n('RSS feed'),
     
    336311{ // upload a picture in the category
    337312  $url = get_root_url().'upload.php?cat='.$page['category']['id'];
    338   $template->assign_block_vars(
    339     'upload',
    340     array(
    341       'U_UPLOAD'=> $url
    342       )
    343     );
     313  $template->assign('U_UPLOAD', $url);
    344314}
    345315
  • trunk/include/page_tail.php

    r2227 r2231  
    4545//------------------------------------------------------------- generation time
    4646$debug_vars = array();
     47
     48if ($conf['show_queries'])
     49{
     50  $debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug) );
     51}
     52
    4753if ($conf['show_gt'])
    4854{
    49   $time = get_elapsed_time($t2, get_moment());
    50 
    5155  if (!isset($page['count_queries']))
    5256  {
     
    5458    $page['queries_time'] = 0;
    5559  }
     60  $time = get_elapsed_time($t2, get_moment());
    5661
    5762  $debug_vars = array_merge($debug_vars,
     
    6267}
    6368
    64 if ($conf['show_queries'])
    65 {
    66   $debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug) );
    67 }
    68 
    6969$template->assign('debug', $debug_vars );
    7070
     
    7373// Generate the page
    7474//
    75 $template->pparse('tail');
     75$template->parse('tail');
     76$template->p();
    7677?>
  • trunk/include/smarty/libs/Smarty.class.php

    r2216 r2231  
    10581058            // var non-existant, return valid reference
    10591059            $_tmp = null;
    1060             return $_tmp;   
     1060            return $_tmp;
    10611061        }
    10621062    }
     
    11171117    {
    11181118        static $_cache_info = array();
    1119        
     1119
    11201120        $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
    11211121               ? $this->error_reporting : error_reporting() & ~E_NOTICE);
     
    12931293        if ($display) {
    12941294            if (isset($_smarty_results)) { echo $_smarty_results; }
     1295        }
     1296
     1297        if ($this->debugging) {
     1298            // capture time for debugging info
     1299            $_params = array();
     1300            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
     1301            $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
     1302        }
     1303
     1304        if ($display) {
    12951305            if ($this->debugging) {
    12961306                // capture time for debugging info
    12971307                $_params = array();
    1298                 require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
    1299                 $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
    13001308                require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
    13011309                echo smarty_core_display_debug_console($_params, $this);
     
    19331941        return eval($code);
    19341942    }
    1935    
     1943
    19361944    /**
    19371945     * Extracts the filter name from the given callback
    1938      * 
     1946     *
    19391947     * @param callback $function
    19401948     * @return string
     
    19511959                }
    19521960        }
    1953    
     1961
    19541962    /**#@-*/
    19551963
  • trunk/include/template.class.php

    r2217 r2231  
    224224  function parse($handle, $return=false)
    225225  {
    226     return $this->_pparse_or_parse($handle, $return, false);
    227   }
    228 
    229   /**
    230    * Load the file for the handle, eventually compile the file and run the compiled
    231    * code. This will print out the results of executing the template.
    232    */
    233   function pparse($handle)
    234   {
    235     $this->_pparse_or_parse($handle, false, true);
    236   }
    237 
    238 
    239   /*private*/ function _pparse_or_parse($handle, $return, $immediate_display)
    240   {
    241226    if ( !isset($this->files[$handle]) )
    242227    {
     
    254239    if ($is_new)
    255240    {
    256       $this->smarty->assign( 'pwg_root', get_root_url() ); //deprecated
    257241      $this->smarty->assign( 'ROOT_URL', get_root_url() );
    258       if ($immediate_display)
    259         $this->p();
    260       $v = $this->smarty->fetch($this->files[$handle], null, null, $immediate_display ? true : false);
    261       if ($immediate_display)
    262         return;
     242      $v = $this->smarty->fetch($this->files[$handle], null, null, false);
    263243    }
    264244    else
     
    267247      $v = $this->_old->parse($handle, true);
    268248    }
    269     if ($return==false)
    270     {
    271       $this->output .= $v;
    272     }
    273     return $v;
    274   }
    275 
    276   /** flushes current output */
    277   function p()
    278   {
     249    if ($return)
     250    {
     251      return $v;
     252    }
     253    $this->output .= $v;
     254  }
     255
     256  /**
     257   * Load the file for the handle, eventually compile the file and run the compiled
     258   * code. This will print out the results of executing the template.
     259   */
     260  function pparse($handle)
     261  {
     262    $this->parse($handle, false);
    279263    echo $this->output;
    280264    $this->output='';
     265
     266  }
     267
     268
     269  /** flushes the output */
     270  function p()
     271  {
     272    $start = get_moment();
     273
     274    echo $this->output;
     275    $this->output='';
     276
     277    if ($this->smarty->debugging)
     278    {
     279      global $t2;
     280      $this->smarty->assign(
     281        array(
     282        'AAAA_DEBUG_OUTPUT_TIME__' => get_elapsed_time($start, get_moment()),
     283        'AAAA_DEBUG_TOTAL_TIME__' => get_elapsed_time($t2, get_moment())
     284        )
     285        );
     286      require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
     287      echo smarty_core_display_debug_console(null, $this->smarty);
     288    }
    281289  }
    282290
     
    314322  {
    315323    $this->smarty->append( $tpl_var, $value, $merge );
     324  }
     325
     326  /** see smarty get_template_vars http://www.smarty.net/manual/en/api.get_template_vars.php */
     327  function &get_template_vars($name=null)
     328  {
     329    return $this->smarty->get_template_vars( $name );
    316330  }
    317331
Note: See TracChangeset for help on using the changeset viewer.