b2evolution PHP Cross Reference Blogging Systems

Source: /skins/_item_content.inc.php - 326 lines - 13001 bytes - Text - Print

Description: This is the template that displays the contents for a post (images, teaser, more link, body, etc...)

   1  <?php
   2  /**
   3   * This is the template that displays the contents for a post
   4   * (images, teaser, more link, body, etc...)
   5   *
   6   * This file is not meant to be called directly.
   7   * It is meant to be called by an include in the main.page.php template (or other templates)
   8   *
   9   * b2evolution - {@link http://b2evolution.net/}
  10   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  11   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
  12   *
  13   * @package evoskins
  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  global $disp_detail;
  18  global $more;
  19  global $shutdown_count_item_views;
  20  
  21  // Default params:
  22  $params = array_merge( array(
  23          'content_mode'             => 'auto', // Can be 'excerpt', 'normal' or 'full'. 'auto' will auto select depending on backoffice SEO settings for $disp-detail
  24          'intro_mode'               => 'auto', // Same as above. This will typically be forced to "normal" when displaying an intro section so that intro posts always display as normal there
  25          'force_more'               => false, // This will be set to true id 'content_mode' resolves to 'full'.
  26  
  27          'content_display_full'     => true, // Do we want to display post content at all, false to display images/attachments only
  28          'content_start_excerpt'    => '<div class="content_excerpt">',
  29          'content_end_excerpt'      => '</div>',
  30          'content_start_full'       => '<div class="content_full">',
  31          'content_end_full'         => '</div>',
  32          'excerpt_before_text'      => '<div class="excerpt">',
  33          'excerpt_after_text'       => '</div>',
  34          'excerpt_before_more'      => ' <span class="excerpt_more">',
  35          'excerpt_after_more'       => '</span>',
  36          'excerpt_more_text'        => T_('more').' &raquo;',
  37          'before_content_teaser'    => '',
  38          'after_content_teaser'     => '',
  39          'before_content_extension' => '',
  40          'after_content_extension'  => '',
  41  
  42          'before_images'            => '<div class="bImages">',
  43          'before_image'             => '<div class="image_block">',
  44          'before_image_legend'      => '<div class="image_legend">',
  45          'after_image_legend'       => '</div>',
  46          'after_image'              => '</div>',
  47          'after_images'             => '</div>',
  48          'image_size'               => 'fit-400x320',
  49          'image_limit'              =>  1000,
  50          'image_link_to'            => 'original', // Can be 'original', 'single' or empty
  51          'excerpt_image_size'       => 'fit-80x80',
  52          'excerpt_image_limit'      => 1,
  53          'excerpt_image_link_to'    => 'single',
  54  
  55          'before_gallery'           => '<div class="bGallery">',
  56          'after_gallery'            => '</div>',
  57          'gallery_image_size'       => 'crop-80x80',
  58          'gallery_image_limit'      => 1000,
  59          'gallery_colls'            => 5,
  60          'gallery_order'            => '', // Can be 'ASC', 'DESC', 'RAND' or empty
  61  
  62          'before_url_link'          => '<p class="post_link">'.T_('Link:').' ',
  63          'after_url_link'           => '</p>',
  64          'url_link_text_template'   => '$url$', // If evaluates to empty, nothing will be displayed (except player if podcast)
  65          'url_link_url_template'    => '$url$', // $url$ will be replaced with saved URL address
  66          'url_link_target'          => '', // Link target attribute e.g. '_blank'
  67          'before_more_link'         => '<p class="bMore">',
  68          'after_more_link'          => '</p>',
  69          'more_link_text'           => '#',
  70          'more_link_to'             => 'single#anchor', // Can be 'single' or 'single#anchor' which is permalink + "#more55" where 55 is item ID
  71          'anchor_text'              => '<p class="bMore">...</p>', // Text to display as the more anchor (once the more link has been clicked, '#' defaults to "Follow up:")
  72  
  73          'limit_attach'             => 1000,
  74          'attach_list_start'        => '<div class="attachments"><h3>'.T_('Attachments').':</h3><ul class="bFiles">',
  75          'attach_list_end'          => '</ul></div>',
  76          'attach_start'             => '<li>',
  77          'attach_end'               => '</li>',
  78          'before_attach_size'       => ' <span class="file_size">(',
  79          'after_attach_size'        => ')</span>',
  80  
  81          'page_links_start'         => '<p class="right">'.T_('Pages:').' ',
  82          'page_links_end'           => '</p>',
  83          'page_links_separator'     => '&middot; ',
  84          'page_links_single'        => '',
  85          'page_links_current_page'  => '#',
  86          'page_links_pagelink'      => '%d',
  87          'page_links_url'           => '',
  88  
  89          'footer_text_mode'         => '#', // 'single', 'xml' or empty. Will detect 'single' from $disp automatically.
  90          'footer_text_start'        => '<div class="item_footer">',
  91          'footer_text_end'          => '</div>',
  92      ), $params );
  93  
  94  // Determine content mode to use..
  95  if( $Item->is_intro() )
  96  {
  97      $content_mode = $params['intro_mode'];
  98  }
  99  else
 100  {
 101      $content_mode = $params['content_mode'];
 102  }
 103  if( $content_mode == 'auto' )
 104  {
 105      // echo $disp_detail;
 106      switch( $disp_detail )
 107      {
 108          case 'posts-cat':
 109          case 'posts-subcat':
 110              $content_mode = $Blog->get_setting('chapter_content');
 111              break;
 112  
 113          case 'posts-tag':
 114              $content_mode = $Blog->get_setting('tag_content');
 115              break;
 116  
 117          case 'posts-date':
 118              $content_mode = $Blog->get_setting('archive_content');
 119              break;
 120  
 121          case 'posts-filtered':
 122          case 'search':
 123              $content_mode = $Blog->get_setting('filtered_content');
 124              break;
 125  
 126          case 'single':
 127          case 'page':
 128              $content_mode = 'full';
 129              break;
 130  
 131          case 'posts-default':  // home page 1
 132          case 'posts-next':     // next page 2, 3, etc
 133          default:
 134              $content_mode = $Blog->get_setting('main_content');
 135      }
 136  }
 137  
 138  switch( $content_mode )
 139  {
 140      case 'excerpt':
 141          // Reduced display:
 142          echo $params['content_start_excerpt'];
 143  
 144          if( !empty($params['excerpt_image_size']) )
 145          {
 146              // Display images that are linked to this post:
 147              $Item->images( array(
 148                      'before'              => $params['before_images'],
 149                      'before_image'        => $params['before_image'],
 150                      'before_image_legend' => $params['before_image_legend'],
 151                      'after_image_legend'  => $params['after_image_legend'],
 152                      'after_image'         => $params['after_image'],
 153                      'after'               => $params['after_images'],
 154                      'image_size'          => $params['excerpt_image_size'],
 155                      'limit'               => $params['excerpt_image_limit'],
 156                      'image_link_to'       => $params['excerpt_image_link_to'],
 157                      'before_gallery'      => $params['before_gallery'],
 158                      'after_gallery'       => $params['after_gallery'],
 159                      'gallery_image_size'  => $params['gallery_image_size'],
 160                      'gallery_image_limit' => $params['gallery_image_limit'],
 161                      'gallery_colls'       => $params['gallery_colls'],
 162                      'gallery_order'       => $params['gallery_order'],
 163                      'restrict_to_image_position' => 'teaser', // Optionally restrict to files/images linked to specific position: 'teaser'|'aftermore'
 164                  ) );
 165          }
 166  
 167          $Item->excerpt( array(
 168              'before'              => $params['excerpt_before_text'],
 169              'after'               => $params['excerpt_after_text'],
 170              'excerpt_before_more' => $params['excerpt_before_more'],
 171              'excerpt_after_more'  => $params['excerpt_after_more'],
 172              'excerpt_more_text'   => $params['excerpt_more_text'],
 173              ) );
 174  
 175          echo $params['content_end_excerpt'];
 176          break;
 177  
 178      case 'full':
 179          $params['force_more'] = true;
 180          $params['anchor_text'] = '';
 181          /* continue down */
 182      case 'normal':
 183      default:
 184          // Full dislpay:
 185          echo $params['content_start_full'];
 186  
 187          // Increment view count of first post on page:
 188          $shutdown_count_item_views[] = $Item->ID;
 189  
 190          if( ! empty($params['image_size']) )
 191          {
 192              // Display images that are linked to this post:
 193              $Item->images( array(
 194                      'before'              => $params['before_images'],
 195                      'before_image'        => $params['before_image'],
 196                      'before_image_legend' => $params['before_image_legend'],
 197                      'after_image_legend'  => $params['after_image_legend'],
 198                      'after_image'         => $params['after_image'],
 199                      'after'               => $params['after_images'],
 200                      'image_size'          => $params['image_size'],
 201                      'limit'               => $params['image_limit'],
 202                      'image_link_to'       => $params['image_link_to'],
 203                      'before_gallery'      => $params['before_gallery'],
 204                      'after_gallery'       => $params['after_gallery'],
 205                      'gallery_image_size'  => $params['gallery_image_size'],
 206                      'gallery_image_limit' => $params['gallery_image_limit'],
 207                      'gallery_colls'       => $params['gallery_colls'],
 208                      'gallery_order'       => $params['gallery_order'],
 209                      // Optionally restrict to files/images linked to specific position: 'teaser'|'aftermore'
 210                      'restrict_to_image_position' => 'teaser',
 211                  ) );
 212          }
 213  
 214          if( $params['content_display_full'] )
 215          {
 216              echo '<div class="bText">';
 217  
 218              // URL link, if the post has one:
 219              $Item->url_link( array(
 220                      'before'        => $params['before_url_link'],
 221                      'after'         => $params['after_url_link'],
 222                      'text_template' => $params['url_link_text_template'],
 223                      'url_template'  => $params['url_link_url_template'],
 224                      'target'        => $params['url_link_target'],
 225                      'podcast'       => '#', // Auto display mp3 player if post type is podcast (=> false, to disable)
 226                  ) );
 227  
 228              // Display CONTENT:
 229              $Item->content_teaser( array(
 230                      'before'              => $params['before_content_teaser'],
 231                      'after'               => $params['after_content_teaser'],
 232                      'before_image'        => $params['before_image'],
 233                      'before_image_legend' => $params['before_image_legend'],
 234                      'after_image_legend'  => $params['after_image_legend'],
 235                      'after_image'         => $params['after_image'],
 236                      'image_size'          => $params['image_size'],
 237                      'limit'               => $params['image_limit'],
 238                      'image_link_to'       => $params['image_link_to'],
 239                  ) );
 240  
 241              $Item->more_link( array(
 242                      'force_more'  => $params['force_more'],
 243                      'before'      => $params['before_more_link'],
 244                      'after'       => $params['after_more_link'],
 245                      'link_text'   => $params['more_link_text'],
 246                      'anchor_text' => $params['anchor_text'],
 247                      'link_to'     => $params['more_link_to'],
 248                  ) );
 249  
 250              if( ! empty($params['image_size']) && $more && $Item->has_content_parts($params) /* only if not displayed all images already */ )
 251              {
 252                  // Display images that are linked to this post:
 253                  $Item->images( array(
 254                          'before'              => $params['before_images'],
 255                          'before_image'        => $params['before_image'],
 256                          'before_image_legend' => $params['before_image_legend'],
 257                          'after_image_legend'  => $params['after_image_legend'],
 258                          'after_image'         => $params['after_image_legend'],
 259                          'after'               => $params['after_images'],
 260                          'image_size'          => $params['image_size'],
 261                          'limit'               => $params['image_limit'],
 262                          'image_link_to'       => $params['image_link_to'],
 263                          'before_gallery'      => $params['before_gallery'],
 264                          'after_gallery'       => $params['after_gallery'],
 265                          'gallery_image_size'  => $params['gallery_image_size'],
 266                          'gallery_image_limit' => $params['gallery_image_limit'],
 267                          'gallery_colls'       => $params['gallery_colls'],
 268                          'gallery_order'       => $params['gallery_order'],
 269                          // Optionally restrict to files/images linked to specific position: 'teaser'|'aftermore'
 270                          'restrict_to_image_position' => 'aftermore',
 271                      ) );
 272              }
 273  
 274              $Item->content_extension( array(
 275                      'before'      => $params['before_content_extension'],
 276                      'after'       => $params['after_content_extension'],
 277                      'force_more'  => $params['force_more'],
 278                  ) );
 279  
 280              // Links to post pages (for multipage posts):
 281              $Item->page_links( array(
 282                      'before'      => $params['page_links_start'],
 283                      'after'       => $params['page_links_end'],
 284                      'separator'   => $params['page_links_separator'],
 285                      'single'      => $params['page_links_single'],
 286                      'current_page'=> $params['page_links_current_page'],
 287                      'pagelink'    => $params['page_links_pagelink'],
 288                      'url'         => $params['page_links_url'],
 289                  ) );
 290  
 291              // Display Item footer text (text can be edited in Blog Settings):
 292              $Item->footer( array(
 293                      'mode'        => $params['footer_text_mode'], // Will detect 'single' from $disp automatically
 294                      'block_start' => $params['footer_text_start'],
 295                      'block_end'   => $params['footer_text_end'],
 296                  ) );
 297  
 298              echo '</div>';
 299          }
 300  
 301          if( ! empty($params['limit_attach'])
 302              && ( $more || ! $Item->has_content_parts($params) ) )
 303          {    // Display attachments/files that are linked to this post:
 304              $Item->files( array(
 305                      'before' =>              $params['attach_list_start'],
 306                      'before_attach' =>       $params['attach_start'],
 307                      'before_attach_size' =>  $params['before_attach_size'],
 308                      'after_attach_size' =>   $params['after_attach_size'],
 309                      'after_attach' =>        $params['attach_end'],
 310                      'after' =>               $params['attach_list_end'],
 311                      'limit_attach' =>        $params['limit_attach'],
 312                  ) );
 313          }
 314  
 315          // Display location info
 316          $Item->location( '<div class="item_location"><strong>'.T_('Location').': </strong>', '</div>' );
 317  
 318          if( $disp == 'single' )
 319          {    // Display custom fields
 320              $Item->custom_fields();
 321          }
 322  
 323          echo $params['content_end_full'];
 324  
 325  }
 326  ?>

title

Description

title

Description

title

Description

title

title

Body