b2evolution PHP Cross Reference Blogging Systems

Source: /multiblogs.php - 452 lines - 14928 bytes - Summary - Text - Print

Description: This is a demo template displaying multiple blogs on the same page If you're new to b2evolution templates or skins, you should not start with this file It will be easier to start examining blog_a.php or noskin_a.php for instance...

   1  <?php
   2  /**
   3   * This is a demo template displaying multiple blogs on the same page
   4   *
   5   * If you're new to b2evolution templates or skins, you should not start with this file
   6   * It will be easier to start examining blog_a.php or noskin_a.php for instance...
   7   *
   8   * @package evoskins
   9   * @subpackage noskin
  10   */
  11  
  12  # First blog will be displayed the regular way (why bother?)
  13  $blog = 1;
  14  
  15  # Tell b2evolution you don't want to use evoSkins
  16  # (evoSkins are designed to display only one blog at once + optionnaly a linkblog)
  17  $skin = '';
  18  
  19  # This setting retricts posts to those published, thus hiding drafts.
  20  # You should not have to change this.
  21  $show_statuses = array();
  22  
  23  # Additionnaly, you can set other values (see URL params in the manual)...
  24  # $order = 'ASC'; // This for example would display the blog in chronological order...
  25  
  26  # Tell b2evolution not to redirect. This is necessary only if "301" for homepage is checked and the blog URL is set
  27  # to something else than this page -- which is the case on demo installs.
  28  # For production systems, properly set the blog URL , then remove the line below:
  29  $redir = 'no';
  30  
  31  /**
  32   * Let b2evolution handle the query string and load the blog data:
  33   */
  34  require_once dirname(__FILE__).'/conf/_config.php';
  35  
  36  require_once $inc_path.'_blog_main.inc.php';
  37  
  38  // Make sure includes will check in the current folder!
  39  $ads_current_skin_path = dirname(__FILE__).'/';
  40  
  41  
  42  # Now, below you'll find the magic template...
  43  
  44  
  45  // --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
  46  // Note: This is totally optional. General caching must be enabled in Global settings, otherwise this will do nothing.
  47  // Delete this block if you don't care about page level caching. Don't forget to delete the matching section at the end of the page.
  48  load_class( '_core/model/_pagecache.class.php', 'PageCache' );
  49  $PageCache = new PageCache( NULL );
  50  // Check for cached content & Start caching if needed:
  51  if( ! $PageCache->check() )
  52  {    // Cache miss, we have to generate:
  53      // --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
  54  
  55  
  56  // This is the main template; it may be used to display very different things.
  57  // Do inits depending on current $disp:
  58  skin_init( $disp );
  59  
  60  // Add CSS:
  61  require_css( 'basic_styles.css', 'rsc_url' ); // the REAL basic styles
  62  require_css( 'basic.css', 'rsc_url' ); // Basic styles
  63  require_css( 'blog_base.css', 'rsc_url' ); // Default styles for the blog navigation
  64  require_css( 'item_base.css', 'rsc_url' ); // Default styles for the post CONTENT
  65  require_css( 'fp02.css', 'rsc_url' );
  66  
  67  add_js_for_toolbar();        // Registers all the javascripts needed by the toolbar menu
  68  
  69  // Functions to work with AJAX response data
  70  require_js( '#jquery#', 'rsc_url' );
  71  require_js( '#jqueryUI#', 'rsc_url' );
  72  require_js( 'ajax.js', 'rsc_url' );
  73  
  74  headers_content_mightcache( 'text/html' );        // In most situations, you do NOT want to cache dynamic content!
  75  ?>
  76  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  77  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php locale_lang() ?>" lang="<?php locale_lang() ?>"><!-- InstanceBegin template="/Templates/Standard.dwt" codeOutsideHTMLIsLocked="false" -->
  78  <head>
  79  <!-- InstanceBeginEditable name="doctitle" -->
  80      <title><?php
  81          // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------
  82          request_title( array(
  83              'title_before'=> '',
  84              'title_after' => ' - ',
  85              'title_none'  => '',
  86              'glue'        => ' - ',
  87              'format'      => 'htmlhead',
  88          ) );
  89          // ------------------------------ END OF REQUEST TITLE -----------------------------
  90      ?>Multiblog Demo</title>
  91      <!-- InstanceEndEditable -->
  92  <!-- InstanceBeginEditable name="head" -->
  93      <?php skin_base_tag(); /* You're not using any skin here but this won't hurt. However it will be very helpful to have this here when you make the switch to a skin! */ ?>
  94      <?php skin_description_tag(); ?>
  95      <?php skin_keywords_tag(); ?>
  96      <meta name="generator" content="b2evolution <?php echo $app_version ?>" /> <!-- Please leave this for stats -->
  97      <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php $Blog->disp( 'rss2_url', 'raw' ) ?>" />
  98      <link rel="alternate" type="application/atom+xml" title="Atom" href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>" />
  99      <?php include_headlines() /* Add javascript and css files included by plugins and skin */ ?>
 100      <!-- InstanceEndEditable -->
 101  </head>
 102  <body>
 103  <!-- InstanceBeginEditable name="ToolBar" -->
 104  <?php
 105      // ---------------------------- TOOLBAR INCLUDED HERE ----------------------------
 106      require $skins_path.'_toolbar.inc.php';
 107      // ------------------------------- END OF TOOLBAR --------------------------------
 108      echo "\n";
 109      if( show_toolbar() )
 110      {
 111          echo '<div id="skin_wrapper" class="skin_wrapper_loggedin">';
 112      }
 113      else
 114      {
 115          echo '<div id="skin_wrapper" class="skin_wrapper_anonymous">';
 116      }
 117      echo "\n";
 118  ?>
 119  <!-- InstanceEndEditable -->
 120  <div class="pageHeader">
 121  <!-- InstanceBeginEditable name="NavBar2" -->
 122  <?php
 123      // --------------------------------- START OF BLOG LIST --------------------------------
 124      skin_widget( array(
 125                          // CODE for the widget:
 126                          'widget' => 'colls_list_public',
 127                          // Optional display params
 128                          'block_start' => '<div class="NavBar">',
 129                          'block_end' => '</div>',
 130                          'block_display_title' => false,
 131                          'list_start' => '',
 132                          'list_end' => '',
 133                          'item_start' => '',
 134                          'item_end' => '',
 135                          'item_selected_start' => '',
 136                          'item_selected_end' => '',
 137                          'link_selected_class' => 'NavButton2',
 138                          'link_default_class' => 'NavButton2',
 139                  ) );
 140      // ---------------------------------- END OF BLOG LIST ---------------------------------
 141  ?>
 142  <!-- InstanceEndEditable -->
 143  <div class="pageTitle">
 144  <h1 id="pageTitle"><!-- InstanceBeginEditable name="PageTitle" --><?php echo T_('Multiblog demo') ?><!-- InstanceEndEditable --></h1>
 145  </div>
 146  </div>
 147  
 148  
 149  <div class="pageSubTitle"><!-- InstanceBeginEditable name="SubTitle" --><?php echo T_('This demo template displays 3 blogs at once (1 on the left, 2 on the right)') ?><!-- InstanceEndEditable --></div>
 150  
 151  
 152  <div class="main"><!-- InstanceBeginEditable name="Main" -->
 153  
 154  <!-- =================================== START OF MAIN AREA =================================== -->
 155  
 156  <div class="bPosts">
 157      <h2>#1: <a href="<?php $Blog->disp( 'blogurl', 'raw' ) ?>"><?php echo $Blog->disp( 'name', 'htmlbody' ) ?></a></h2>
 158  
 159      <?php
 160          // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------
 161          request_title( array(
 162                  'title_before'=> '<h2>',
 163                  'title_after' => '</h2>',
 164                  'title_none'  => '',
 165                  'glue'        => ' - ',
 166                  'title_single_disp' => true,
 167                  'format'      => 'htmlbody',
 168              ) );
 169          // ------------------------------ END OF REQUEST TITLE -----------------------------
 170      ?>
 171  
 172      <?php // ------------------------------------ START OF POSTS ----------------------------------------
 173          // Display message if no post:
 174          display_if_empty();
 175  
 176          while( $Item = & mainlist_get_item() )
 177          {    // For each blog post, do everything below up to the closing curly brace "}"
 178              ?>
 179  
 180              <?php
 181              // ------------------------------ DATE SEPARATOR ------------------------------
 182              $MainList->date_if_changed( array(
 183                      'before'      => '<h2>',
 184                      'after'       => '</h2>',
 185                      'date_format' => '#',
 186                  ) );
 187              ?>
 188  
 189          <div id="<?php $Item->anchor_id() ?>" class="bPost bPost<?php $Item->status_raw() ?>" lang="<?php $Item->lang() ?>">
 190  
 191              <div class="bSmallHead">
 192              <?php
 193                  $Item->permanent_link( array(
 194                          'text' => '#icon#',
 195                      ) );
 196              ?>
 197              <?php
 198                  $Item->issue_time(); // Post issue time
 199              ?>
 200              <?php
 201                  $Item->categories( array(
 202                      'before'          => ', '.T_('Categories').': ',
 203                      'after'           => ' ',
 204                      'include_main'    => true,
 205                      'include_other'   => true,
 206                      'include_external'=> true,
 207                      'link_categories' => true,
 208                  ) );
 209              ?>
 210              </div>
 211              <h3 class="bTitle"><?php $Item->title(); ?></h3>
 212  
 213              <?php
 214                  // ---------------------- POST CONTENT INCLUDED HERE ----------------------
 215                  skin_include( '_item_content.inc.php', array(
 216                          'image_size'    =>    'fit-400x320',
 217                      ) );
 218                  // Note: You can customize the default item feedback by copying the generic
 219                  // /skins/_item_feedback.inc.php file into the current skin folder.
 220                  // -------------------------- END OF POST CONTENT -------------------------
 221              ?>
 222  
 223              <div class="bSmallPrint">
 224                  <?php
 225                      // Link to comments, trackbacks, etc.:
 226                      $Item->feedback_link( array(
 227                                      'type' => 'comments',
 228                                      'link_before' => '',
 229                                      'link_after' => ' &bull; ',
 230                                      'link_text_zero' => '#',
 231                                      'link_text_one' => '#',
 232                                      'link_text_more' => '#',
 233                                      'link_title' => '#',
 234                                      'use_popup' => false,
 235                                  ) );
 236                   ?>
 237                  <?php
 238                      // Link to comments, trackbacks, etc.:
 239                      $Item->feedback_link( array(
 240                                      'type' => 'trackbacks',
 241                                      'link_before' => '',
 242                                      'link_after' => ' &bull; ',
 243                                      'link_text_zero' => '#',
 244                                      'link_text_one' => '#',
 245                                      'link_text_more' => '#',
 246                                      'link_title' => '#',
 247                                      'use_popup' => false,
 248                                  ) );
 249                   ?>
 250  
 251                  <?php    $Item->permanent_link(); ?>
 252              </div>
 253  
 254              <?php
 255                  // ------------------ FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE ------------------
 256                  skin_include( '_item_feedback.inc.php', array(
 257                          'before_section_title' => '<h4>',
 258                          'after_section_title'  => '</h4>',
 259                      ) );
 260                  // Note: You can customize the default item feedback by copying the generic
 261                  // /skins/_item_feedback.inc.php file into the current skin folder.
 262                  // ---------------------- END OF FEEDBACK (COMMENTS/TRACKBACKS) ---------------------
 263              ?>
 264          </div>
 265      <?php
 266          } // ---------------------------------- END OF POSTS ------------------------------------
 267      ?>
 268  
 269      <?php
 270          // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------
 271          mainlist_page_links( array(
 272                  'block_start' => '<p class="center"><strong>',
 273                  'block_end' => '</strong></p>',
 274                  'links_format' => '$prev$ :: $next$',
 275                 'prev_text' => '&lt;&lt; '.T_('Previous'),
 276                 'next_text' => T_('Next').' &gt;&gt;',
 277              ) );
 278          // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------
 279      ?>
 280  
 281      <?php
 282          // -------------- MAIN CONTENT TEMPLATE INCLUDED HERE (Based on $disp) --------------
 283          skin_include( '$disp$', array(
 284                  'disp_posts'  => '',        // We already handled this case above
 285                  'disp_single' => '',        // We already handled this case above
 286                  'disp_page'   => '',        // We already handled this case above
 287              ) );
 288          // Note: you can customize any of the sub templates included here by
 289          // copying the matching php file into your skin directory.
 290          // ------------------------- END OF MAIN CONTENT TEMPLATE ---------------------------
 291      ?>
 292  
 293  </div>
 294  
 295  <!-- =================================== START OF SIDEBAR =================================== -->
 296  
 297  <div class="bSideBar">
 298  
 299      <!-- =================================== START OF BLOG B =================================== -->
 300  
 301      <div class="bSideItem">
 302          <?php
 303          $BlogCache = & get_BlogCache();
 304          $Blog_B = & $BlogCache->get_by_ID( 2, false );
 305          if( empty($Blog_B) )
 306          {
 307              echo sprintf( T_('Blog #%d doesn\'t seem to exist.'), 2 );
 308          }
 309          else
 310          {
 311              ?>
 312  
 313              <h3>#2: <a href="<?php $Blog_B->disp( 'blogurl', 'raw' ) ?>"><?php echo $Blog_B->disp( 'name', 'htmlbody' ) ?></a></h3>
 314              <?php
 315              $BlogBList = new ItemList2( $Blog_B, $Blog_B->get_timestamp_min(), $Blog_B->get_timestamp_max(), $posts );
 316  
 317              $BlogBList->set_filters( array(
 318                      'authors' => $author,
 319                      'ymdhms' => $m,
 320                      'week' => $w,
 321                      'order' => $order,
 322                      'orderby' => $orderby,
 323                      'unit' => $unit,
 324                  ) );
 325  
 326              // Run the query:
 327              $BlogBList->query();
 328  
 329              while( $Item = & $BlogBList->get_item() )
 330              {
 331                  ?>
 332                  <div id="<?php $Item->anchor_id() ?>" class="bPostSide bPostSide<?php $Item->status_raw() ?>" lang="<?php $Item->lang() ?>">
 333  
 334                      <h4 class="bTitle">
 335                          <?php
 336                              $Item->permanent_link( array(
 337                                      'text' => '#icon#',
 338                                  ) );
 339                          ?>
 340                          <?php $Item->title(); ?>
 341                      </h4>
 342                      <div class="bText">
 343                          <?php
 344                              // Display CONTENT (teaser only):
 345                              $Item->content_teaser( array(
 346                                      'before'      => '',
 347                                      'after'       => '',
 348                                      'disppage'    => 1,
 349                                      'stripteaser' => false,
 350                                      'image_size'  => 'fit-400x320',
 351                                  ) );
 352                          ?>
 353                      </div>
 354                  </div>
 355                  <?php
 356              }
 357          }
 358          ?>
 359      </div>
 360  
 361      <!-- =================================== START OF BLOG C =================================== -->
 362  
 363      <div class="bSideItem">
 364          <?php
 365          $Blog_roll = & $BlogCache->get_by_ID( 3, false );
 366          if( empty($Blog_roll) )
 367          {
 368              echo sprintf( T_('Blog #%d doesn\'t seem to exist.'), 3 );
 369          }
 370          else
 371          {
 372          ?>
 373          <h3>#3: <a href="<?php $Blog_roll->disp( 'blogurl', 'raw' ) ?>"><?php echo $Blog_roll->disp( 'name', 'htmlbody' ) ?></a></h3>
 374          <?php
 375          $LinkblogList = new ItemList2( $Blog_roll, $Blog_roll->get_timestamp_min(), $Blog_roll->get_timestamp_max(), $posts );
 376  
 377          $LinkblogList->set_filters( array(
 378                  'authors' => $author,
 379                  'ymdhms' => $m,
 380                  'week' => $w,
 381                  'order' => $order,
 382                  'orderby' => $orderby,
 383                  'unit' => $unit,
 384              ) );
 385  
 386          // Run the query:
 387          $LinkblogList->query();
 388  
 389          while( $Item = & $LinkblogList->get_item() )
 390          {
 391              ?>
 392              <div id="<?php $Item->anchor_id() ?>" class="bPostSide bPostSide<?php $Item->status_raw() ?>" lang="<?php $Item->lang() ?>">
 393                  <h4 class="bTitle">
 394                      <?php
 395                          $Item->permanent_link( array(
 396                                  'text' => '#icon#',
 397                              ) );
 398                      ?>
 399                      <?php $Item->title(); ?>
 400                  </h4>
 401                  <div class="bText">
 402                      <?php
 403                          // Display CONTENT (teaser only):
 404                          $Item->content_teaser( array(
 405                                  'before'      => '',
 406                                  'after'       => '',
 407                                  'disppage'    => 1,
 408                                  'stripteaser' => false,
 409                                  'image_size'  => 'fit-400x320',
 410                              ) );
 411                      ?>
 412                  </div>
 413              </div>
 414              <?php
 415          }
 416          }
 417          ?>
 418      </div>
 419  
 420      <!-- =================================== END OF BLOG C =================================== -->
 421  
 422      <div class="bSideItem">
 423          <h3><?php echo T_('Misc') ?></h3>
 424          <ul>
 425              <?php
 426                  // Administrative links:
 427                  user_login_link( '<li>', '</li>' );
 428                  user_register_link( '<li>', '</li>' );
 429                  user_admin_link( '<li>', '</li>' );
 430                  user_profile_link( '<li>', '</li>' );
 431                  user_subs_link( '<li>', '</li>' );
 432                  user_logout_link( '<li>', '</li>' );
 433              ?>
 434          </ul>
 435      </div>
 436  
 437  </div>
 438  <!-- InstanceEndEditable --></div>
 439  <div class="footer">
 440  This is a demo page for <a href="http://b2evolution.net/">b2evolution</a>.
 441  <!-- InstanceBeginEditable name="Baseline" -->
 442  <?php echo '</div>' ?>
 443  <!-- Note: don't mess with the template here :/ --><!-- InstanceEndEditable --></div>
 444  </body>
 445  <!-- InstanceEnd --></html>
 446  <?php
 447      // --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
 448      // Save collected cached data if needed:
 449      $PageCache->end_collect();
 450  }
 451  // --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
 452  ?>

title

Description

title

Description

title

Description

title

title

Body