b2evolution PHP Cross Reference Blogging Systems

Source: /skins/manual/index.main.php - 441 lines - 16281 bytes - Text - Print

Description: This is the main/default page template for the "manual" skin. This skin only uses one single template which includes most of its features. It will also rely on default includes for specific dispays (like the comment form).

   1  <?php
   2  /**

   3   * This is the main/default page template for the "manual" skin.

   4   *

   5   * This skin only uses one single template which includes most of its features.

   6   * It will also rely on default includes for specific dispays (like the comment form).

   7   *

   8   * For a quick explanation of b2evo 2.0 skins, please start here:

   9   * {@link http://b2evolution.net/man/skin-structure}

  10   *

  11   * The main page template is used to display the blog when no specific page template is available

  12   * to handle the request (based on $disp).

  13   *

  14   * @package evoskins

  15   * @subpackage manual

  16   *

  17   * @version $Id: index.main.php 9 2011-10-24 22:32:00Z fplanque $

  18   */
  19  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  20  
  21  if( version_compare( $app_version, '3.0' ) < 0 )
  22  { // Older skins (versions 2.x and above) should work on newer b2evo versions, but newer skins may not work on older b2evo versions.
  23      die( 'This skin is designed for b2evolution 3.0 and above. Please <a href="http://b2evolution.net/downloads/index.html">upgrade your b2evolution</a>.' );
  24  }
  25  
  26  
  27  /**

  28   * @var string Name of cookie for skin width

  29   */
  30  $cookie_skin_width_name = 'skin_width';
  31  
  32  if( isset( $_COOKIE[ $cookie_skin_width_name ] ) )
  33  { // Get skin width from $_COOKIE through param function
  34      $cookie_skin_width_value = param_cookie( $cookie_skin_width_name, '/^\d+(px|%)$/i', NULL );
  35      if( empty( $cookie_skin_width_value ) )
  36      { // Force illegal value of width to default
  37          $cookie_skin_width_value = '960px';
  38      }
  39  }
  40  
  41  if( $disp == 'posts' && ! isset( $tag ) && isset( $cat ) )
  42  {    // Display a list of categories instead of posts
  43      $cat_array = array( $cat ); // To mark selected category

  44      $disp = 'catdir';
  45  }
  46  
  47  /* yura> The following JS is used for home page and for category page where we have the intro Items.

  48  For normal we need to check if current Item can be rated,

  49  but in the disp == 'posts' or 'catdir' we don't have the object Item in the begining of this file,

  50  we will have that only after calling of function get_featured_Item();

  51  

  52  I understand that we should to initialize the js-functions

  53  of star rating only if we really need in that but

  54  I don't know how it possible when manual skin has a different structure. */
  55  if( $disp == 'posts' || $disp == 'catdir' )
  56  {    // Init the rating js functions, Used for intro posts
  57      init_ratings_js( 'blog', true );
  58  }
  59  
  60  // This is the main template; it may be used to display very different things.

  61  // Do inits depending on current $disp:

  62  skin_init( $disp );
  63  
  64  $catdir_text = '';
  65  if( !empty( $cat ) )
  66  {
  67      $ChapterCache = & get_ChapterCache();
  68      if( $Chapter = & $ChapterCache->get_by_ID( $cat, false ) )
  69      {
  70          $catdir_text = $Chapter->get( 'name' );
  71      }
  72  }
  73  // -------------------------- HTML HEADER INCLUDED HERE --------------------------

  74  skin_include( '_html_header.inc.php', array(
  75          'catdir_text' => $catdir_text,
  76      ) );
  77  // Note: You can customize the default HTML header by copying the generic

  78  // /skins/_html_header.inc.php file into the current skin folder.

  79  // -------------------------------- END OF HEADER --------------------------------

  80  ?>
  81  
  82  
  83  <div class="PageTop">
  84      <?php
  85          // ------------------------- "Page Top" CONTAINER EMBEDDED HERE --------------------------

  86          // Display container and contents:

  87          skin_container( NT_('Page Top'), array(
  88                  // The following params will be used as defaults for widgets included in this container:

  89                  'block_start'         => '<div class="$wi_class$">',
  90                  'block_end'           => '</div>',
  91                  'block_display_title' => false,
  92                  'list_start'          => '<ul>',
  93                  'list_end'            => '</ul>',
  94                  'item_start'          => '<li>',
  95                  'item_end'            => '</li>',
  96              ) );
  97          // ----------------------------- END OF "Page Top" CONTAINER -----------------------------

  98      ?>
  99  </div>
 100  
 101  <div class="pageHeader">
 102      <?php
 103          // ------------------------- "Header" CONTAINER EMBEDDED HERE --------------------------

 104          // Display container and contents:

 105          skin_container( NT_('Header'), array(
 106                  // The following params will be used as defaults for widgets included in this container:

 107                  'block_start'       => '<div class="$wi_class$">',
 108                  'block_end'         => '</div>',
 109                  'block_title_start' => '<h1>',
 110                  'block_title_end'   => '</h1>',
 111              ) );
 112          // ----------------------------- END OF "Header" CONTAINER -----------------------------

 113      ?>
 114  </div>
 115  
 116  <div class="top_menu_bg"></div>
 117  
 118  <div id="layout">
 119      <div id="wrapper"<?php echo ( !empty( $cookie_skin_width_value ) ) ? ' style="width:'.$cookie_skin_width_value.'"' : ''; ?>>
 120  
 121  <div class="top_menu">
 122      <ul>
 123      <?php
 124          // ------------------------- "Menu" CONTAINER EMBEDDED HERE --------------------------

 125          // Display container and contents:

 126          // Note: this container is designed to be a single <ul> list

 127          skin_container( NT_('Menu'), array(
 128                  // The following params will be used as defaults for widgets included in this container:

 129                  'block_start'         => '',
 130                  'block_end'           => '',
 131                  'block_display_title' => false,
 132                  'list_start'          => '',
 133                  'list_end'            => '',
 134                  'item_start'          => '<li>',
 135                  'item_end'            => '</li>',
 136              ) );
 137          // ----------------------------- END OF "Menu" CONTAINER -----------------------------

 138      ?>
 139      </ul>
 140      &nbsp;
 141  </div>
 142  
 143  
 144  <?php
 145  $main_area_class = '';
 146  if( in_array( $disp, array( 'posts', 'single', 'catdir', 'search', 'edit', 'edit_comment', '404' ) ) )
 147  {    // Display sidebar only on these pages
 148  ?>
 149  <!-- =================================== START OF SIDEBAR =================================== -->
 150  <div class="bSideBar">
 151  
 152      <?php
 153          // ------------------------- "Menu Top" CONTAINER EMBEDDED HERE --------------------------

 154          // Display container and contents:

 155          // Note: this container is designed to be a single <ul> list

 156          skin_container( NT_('Menu Top'), array(
 157                  // The following params will be used as defaults for widgets included in this container:

 158                  'block_title_start'   => '',
 159                  'block_title_end'     => '',
 160                  'list_start'          => '',
 161                  'list_end'            => '',
 162                  'item_start'          => '',
 163                  'item_end'            => '',
 164              ) );
 165          // ----------------------------- END OF "Menu Top" CONTAINER -----------------------------

 166  
 167          // ------------------------- CATEGORIES -------------------------

 168          $Skin->display_chapters();
 169          // ------------------------- END OF CATEGORIES ------------------

 170      ?>
 171  
 172      <?php
 173          // Please help us promote b2evolution and leave this logo on your blog:

 174          powered_by( array(
 175                  'block_start' => '<div class="powered_by">',
 176                  'block_end'   => '</div>',
 177                  // Check /rsc/img/ for other possible images -- Don't forget to change or remove width & height too

 178                  'img_url'     => '$rsc$img/powered-by-b2evolution-120t.gif',
 179                  'img_width'   => 120,
 180                  'img_height'  => 32,
 181              ) );
 182      ?>
 183  
 184  </div>
 185  <?php
 186  }
 187  else
 188  {    // If the left sidebar is hidden we should make the width of main area to 100%
 189      $main_area_class = ' full_width';
 190  }
 191  ?>
 192  
 193  <!-- =================================== START OF MAIN AREA =================================== -->
 194  <div class="bPosts<?php echo $main_area_class; ?>">
 195  
 196      <?php
 197          // ------------------------- MESSAGES GENERATED FROM ACTIONS -------------------------

 198          messages( array(
 199                  'block_start' => '<div class="action_messages">',
 200                  'block_end'   => '</div>',
 201              ) );
 202          // --------------------------------- END OF MESSAGES ---------------------------------

 203  
 204          if( !empty( $cat ) )
 205          {    // Display breadcrumbs if some category is selected
 206              $Skin->display_breadcrumbs( $cat );
 207          }
 208      ?>
 209  
 210      <?php
 211          // ------------------------ TITLE FOR THE CURRENT REQUEST ------------------------

 212          request_title( array(
 213                  'title_before'      => '<h1 class="page_title">',
 214                  'title_after'       => '</h1>',
 215                  'title_single_disp' => false,
 216                  'title_page_disp'   => false,
 217                  'format'            => 'htmlbody',
 218                  'edit_text_create'  => T_('Post a new topic'),
 219                  'edit_text_update'  => T_('Edit post'),
 220                  'category_text'     => '',
 221                  'categories_text'   => '',
 222                  'catdir_text'       => ''
 223              ) );
 224          // ----------------------------- END OF REQUEST TITLE ----------------------------

 225      ?>
 226  
 227      <?php
 228      if( empty( $cat ) && $disp == 'posts' )
 229      {    // Home page, display full categories list
 230  
 231          // Go Grab the featured post:

 232          $intro_Item = & get_featured_Item(); // $intro_Item is used below for comments form

 233          $Item = $intro_Item;
 234          if( !empty( $Item ) )
 235          {    // We have a featured/intro post to display:
 236              // ---------------------- ITEM BLOCK INCLUDED HERE ------------------------

 237              skin_include( '_item_block.inc.php', array(
 238                      'feature_block'     => true,
 239                      'content_mode'      => 'auto',        // 'auto' will auto select depending on $disp-detail
 240                      'intro_mode'        => 'normal',    // Intro posts will be displayed in normal mode
 241                      'item_class'        => 'featured_post',
 242                      'image_size'        => 'fit-640x480',
 243                      'disp_comment_form' => false,
 244                      'item_link_type'    => 'none',
 245                  ) );
 246              // ----------------------------END ITEM BLOCK  ----------------------------

 247          }
 248  
 249          echo '<h2 class="table_contents">'.T_('Table of contents').'</h2>';
 250          $Skin->display_chapters( array(
 251                  'display_blog_title' => false,
 252                  'display_children'   => true,
 253                  'class_selected'     => ''
 254              ) );
 255  
 256          if( !empty( $intro_Item ) )
 257          {
 258              global $c, $ReqURI;
 259              $c = 1; // Display comments

 260  
 261              // ------------------ FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE ------------------

 262              skin_include( '_item_feedback.inc.php', array(
 263                      'before_section_title' => '<h2 class="comments_list_title">',
 264                      'after_section_title'  => '</h2>',
 265                      'form_title_start'     => '<h3 class="comments_form_title">',
 266                      'form_title_end'       => '</h3>',
 267                      'Item'                 => $intro_Item,
 268                      'form_title_text'      => T_('Comment form'),
 269                      'comments_title_text'  => T_('Comments on this chapter'),
 270                      'form_comment_redirect_to' => $ReqURI,
 271                  ) );
 272              // Note: You can customize the default item feedback by copying the generic

 273              // /skins/_item_feedback.inc.php file into the current skin folder.

 274              // ---------------------- END OF FEEDBACK (COMMENTS/TRACKBACKS) ---------------------

 275          }
 276  
 277      }
 278      else
 279      {
 280          // Display message if no post:

 281          display_if_empty();
 282  
 283          if( isset( $MainList ) && !empty( $MainList ) && ( $disp == 'posts' || $disp == 'single' ) )
 284          {
 285              // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------

 286              mainlist_page_links( array(
 287                      'block_start' => '<p class="center"><strong>',
 288                      'block_end' => '</strong></p>',
 289                      'prev_text' => '&lt;&lt;',
 290                      'next_text' => '&gt;&gt;',
 291                  ) );
 292              // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------

 293  
 294              // --------------------------------- START OF POSTS -------------------------------------

 295              if( $disp == 'posts' )
 296              {    // Display lists of the posts
 297                  echo '<h4 style="margin-top:20px">'.T_('Pages in this chapter:').'</h4>';
 298                  echo '<ul class="posts_list">';
 299                  while( $Item = & mainlist_get_item() )
 300                  {
 301                      skin_include( '_item_list.inc.php' );
 302                  }
 303                  echo '</ul>';
 304              }
 305              else
 306              {    // disp == single
 307                  if( $Item = & mainlist_get_item() )
 308                  {    // For each blog post, do everything below up to the closing curly brace "}"
 309                      // ---------------------- ITEM BLOCK INCLUDED HERE ------------------------

 310                      skin_include( '_item_block.inc.php', array(
 311                              'content_mode' => 'auto',        // 'auto' will auto select depending on $disp-detail
 312                              'image_size'   => 'fit-640x480',
 313                          ) );
 314                      // ----------------------------END ITEM BLOCK  ----------------------------

 315                  }
 316              }
 317              // ---------------------------------- END OF POSTS ------------------------------------

 318  
 319              // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------

 320              mainlist_page_links( array(
 321                      'block_start' => '<p class="center"><strong>',
 322                      'block_end' => '</strong></p>',
 323                      'prev_text' => '&lt;&lt;',
 324                      'next_text' => '&gt;&gt;',
 325                  ) );
 326              // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------

 327          }
 328      }
 329      ?>
 330  
 331  
 332      <?php
 333          // -------------- MAIN CONTENT TEMPLATE INCLUDED HERE (Based on $disp) --------------

 334          skin_include( '$disp$', array(
 335                  'disp_posts'  => '',        // We already handled this case above
 336                  'disp_single' => '',        // We already handled this case above
 337              ) );
 338          // Note: you can customize any of the sub templates included here by

 339          // copying the matching php file into your skin directory.

 340          // ------------------------- END OF MAIN CONTENT TEMPLATE ---------------------------

 341      ?>
 342  </div>
 343  
 344      </div><?php /** END OF <div id="wrapper"> **/?>
 345  </div><?php /** END OF <div id="layout"> **/?>
 346  
 347  <div class="clear"></div>
 348  
 349  <!-- =================================== START OF FOOTER =================================== -->
 350  <div id="pageFooter">
 351      <?php
 352          // Display container and contents:

 353          skin_container( NT_("Footer"), array(
 354                  // The following params will be used as defaults for widgets included in this container:

 355              ) );
 356          // Note: Double quotes have been used around "Footer" only for test purposes.

 357      ?>
 358      <p class="baseline">
 359          <?php
 360              // Display footer text (text can be edited in Blog Settings):

 361              $Blog->footer_text( array(
 362                      'before'      => '',
 363                      'after'       => ' &bull; ',
 364                  ) );
 365  
 366          // TODO: dh> provide a default class for pTyp, too. Should be a name and not the ptyp_ID though..?!

 367          ?>
 368  
 369          <?php
 370              // Display a link to contact the owner of this blog (if owner accepts messages):

 371              $Blog->contact_link( array(
 372                      'before'      => '',
 373                      'after'       => ' &bull; ',
 374                      'text'   => T_('Contact'),
 375                      'title'  => T_('Send a message to the owner of this blog...'),
 376                  ) );
 377              // Display a link to help page:

 378              $Blog->help_link( array(
 379                      'before'      => ' ',
 380                      'after'       => ' &bull; ',
 381                      'text'        => T_('Help'),
 382                  ) );
 383          ?>
 384  
 385          <?php display_param_link( $skin_links ) ?> by <?php display_param_link( $francois_links ) ?>
 386  
 387          <?php
 388              // Display additional credits:

 389              // If you can add your own credits without removing the defaults, you'll be very cool :))

 390              // Please leave this at the bottom of the page to make sure your blog gets listed on b2evolution.net

 391              credits( array(
 392                      'list_start'  => '&bull;',
 393                      'list_end'    => ' ',
 394                      'separator'   => '&bull;',
 395                      'item_start'  => ' ',
 396                      'item_end'    => ' ',
 397                  ) );
 398          ?>
 399      </p>
 400  </div>
 401  
 402  
 403  <?php
 404  // ------------------------- WIDTH SWITCHER --------------------------

 405  $width_switchers = array(
 406          '960px' => 'width_decrease',
 407          '100%'  => 'width_increase',
 408      );
 409  if( !empty( $cookie_skin_width_value ) )
 410  {    // Fix this cookie value because in the cookie we cannot store the width in percent values (See js function switch_width() to understand why)
 411      $cookie_skin_width_value_fixed = $cookie_skin_width_value != '960px' ? '100%' : $cookie_skin_width_value;
 412  }
 413  ?>
 414  <div id="width_switcher"<?php echo is_logged_in() ? ' style="top:30px"' : ''; ?> class="roundbutton_group">
 415  <?php
 416  $ws = 0;
 417  $ws_count = count( $width_switchers );
 418  foreach( $width_switchers as $ws_size => $ws_icon )
 419  {
 420      $ws_class = 'roundbutton';
 421      if( ( !empty( $cookie_skin_width_value ) && $cookie_skin_width_value_fixed == $ws_size ) ||
 422          ( empty( $cookie_skin_width_value ) && $ws == 0 ) )
 423      {    // Mark this switcher as selected
 424          $ws_class .= ' roundbutton_selected';
 425      }
 426      echo '<a href="#" onclick="switch_width( this, \''.$ws_size.'\', \''.$cookie_skin_width_name.'\', \''.$cookie_path.'\' ); return false;" class="'.$ws_class.'">';
 427      echo get_icon( $ws_icon );
 428      echo '</a>';
 429      $ws++;
 430  }
 431  ?>
 432  </div>
 433  <?php
 434  // ------------------------- END OF WIDTH SWITCHER --------------------------

 435  
 436  // ------------------------- HTML FOOTER INCLUDED HERE --------------------------

 437  skin_include( '_html_footer.inc.php' );
 438  // Note: You can customize the default HTML footer by copying the

 439  // _html_footer.inc.php file into the current skin folder.

 440  // ------------------------------- END OF FOOTER --------------------------------

 441  ?>

title

Description

title

Description

title

Description

title

title

Body