[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/skins/_rss/ -> index.main.php (source)

   1  <?php
   2  /**

   3   * This template generates an RSS 0.92 feed for the requested blog's latest posts

   4   *

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

   6   * {@link http://manual.b2evolution.net/Skins_2.0}

   7   *

   8   * See {@link http://backend.userland.com/rss092}

   9   *

  10   * @package evoskins

  11   * @subpackage rss

  12   *

  13   * @version $Id: index.main.php,v 1.5 2007/11/04 01:10:57 fplanque Exp $

  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  // Note: even if we request the same post as $Item earlier, the following will do more restrictions (dates, etc.)

  18  // Init the MainList object:

  19  init_MainList( $Blog->get_setting('posts_per_feed') );
  20  
  21  // What level of detail do we want?

  22  $feed_content = $Blog->get_setting('feed_content');
  23  if( $feed_content == 'none' )
  24  {    // We don't want to provide this feed!
  25      global $skins_path;
  26      require $skins_path.'_404_not_found.main.php';
  27      exit();
  28  }
  29  
  30  
  31  skin_content_header( 'application/xml' );    // Sets charset!

  32  
  33  echo '<?xml version="1.0" encoding="'.$io_charset.'"?'.'>';
  34  
  35  ?>
  36  <!-- generator="<?php echo $app_name; ?>/<?php echo $app_version ?>" -->
  37  <rss version="0.92">
  38      <channel>
  39          <title><?php
  40              $Blog->disp( 'name', 'xml' );
  41              // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------

  42              request_title( array(
  43                      'title_before'=> ' - ',
  44                      'title_after' => '',
  45                      'title_none'  => '',
  46                      'glue'        => ' - ',
  47                      'title_single_disp' => true,
  48                      'format'      => 'xml',
  49                  ) );
  50              // ------------------------------ END OF REQUEST TITLE -----------------------------

  51          ?></title>
  52          <link><?php $Blog->disp( 'url', 'xml' ) ?></link>
  53          <description><?php $Blog->disp( 'shortdesc' ,'xml' ) ?></description>
  54          <language><?php $Blog->disp( 'locale', 'xml' ) ?></language>
  55          <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  56          <?php
  57          while( $Item = & mainlist_get_item() )
  58          {    // For each blog post, do everything below up to the closing curly brace "}"
  59          ?>
  60          <item>
  61              <title><?php $Item->title( array(
  62                  'format' => 'xml',
  63                  'link_type' => 'none',
  64              ) ); ?></title>
  65              <?php
  66                  if( $feed_content == 'excerpt' )
  67                  {
  68                      ?>
  69              <description><?php
  70                  $content = $Item->get_excerpt( 'entityencoded' );
  71  
  72                  // fp> this is another one of these "oooooh it's just a tiny little change"

  73                  // and "we only need to make the links absolute in RSS"

  74                  // and then you get half baked code! The URL LINK stays RELATIVE!! :((

  75                  // TODO: clean solution : work in format_to_output!

  76                  echo make_rel_links_abs( $content );
  77              ?></description>
  78                      <?php
  79                  }
  80                  elseif( $feed_content == 'normal' )
  81                  {
  82                      ?>
  83              <description><?php
  84                // fp> TODO: make a clear decision on wether or not $before &nd $after get formatted to output or not.

  85                $Item->url_link( '&lt;p&gt;', '&lt;/p&gt;', '%s', array(), 'entityencoded' );
  86  
  87                  // Display images that are linked to this post:

  88                  $content = $Item->get_images( array(
  89                          'before' =>              '<div>',
  90                          'before_image' =>        '<div>',
  91                          'before_image_legend' => '<div><i>',
  92                          'after_image_legend' =>  '</i></div>',
  93                          'after_image' =>         '</div>',
  94                          'after' =>               '</div>',
  95                          'image_size' =>          'fit-320x320'
  96                      ), 'entityencoded' );
  97  
  98                  $content .= $Item->get_content_teaser( 1, false, 'entityencoded' );
  99  
 100                  $content .= $Item->get_more_link( array(
 101                          'before'    => '',
 102                          'after'     => '',
 103                          'disppage'  => 1,
 104                          'format'    => 'entityencoded',
 105                      ) );
 106  
 107                  // fp> this is another one of these "oooooh it's just a tiny little change"

 108                  // and "we only need to make the links absolute in RSS"

 109                  // and then you get half baked code! The URL LINK stays RELATIVE!! :((

 110                  // TODO: clean solution : work in format_to_output!

 111                  echo make_rel_links_abs( $content );
 112              ?></description>
 113              <link><?php $Item->permanent_url( 'single' ) ?></link>
 114                      <?php
 115                  }
 116              ?>
 117          </item>
 118          <?php
 119          }
 120          ?>
 121      </channel>
 122  </rss>
 123  <?php
 124      $Hit->log(); // log the hit on this page

 125  
 126      // This is a self contained XML document, make sure there is no additional output:

 127      exit();
 128  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics