[ 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/_sitemap/ -> index.main.php (source)

   1  <?php
   2  /**

   3   * This template generates a sitemap 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   * @package evoskins

   9   * @subpackage rss

  10   *

  11   * @version $Id: index.main.php,v 1.2 2007/11/03 21:04:29 fplanque Exp $

  12   */
  13  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  14  
  15  $Timer->start( 'prepare list' );
  16  
  17  // Use a LIGHT Item List:  (Sitemap = 50000 entries max)

  18  $MainList = & new ItemListLight( $Blog, $timestamp_min, $timestamp_max, 50000 );
  19  
  20  // By default we only want items that have the MAIN cat in this blog,

  21  // i-e with its canonical URL in this blog (cross posted stuff will be listed in its main blog)

  22  // However this may be overriden in a stub (or param)

  23  param( 'cat_focus', 'string', 'main' );
  24  
  25  // Filter list:

  26  $MainList->set_filters( array(
  27          'visibility_array' => array( 'published' ),  // We only want to advertised published items
  28          'types' => NULL,                        // ALL types (including pages)
  29        'unit' => 'all',                        // We want to advertise all items (not just a page or a day)
  30        'cat_focus' => $cat_focus,
  31      ) );
  32  
  33  // pre_dump( $cat_focus, $MainList->filters );

  34  
  35  // Run the query:

  36  $MainList->query();
  37  
  38  // Old style globals for category.funcs:

  39  $postIDlist = $MainList->get_page_ID_list();
  40  $postIDarray = $MainList->get_page_ID_array();
  41  
  42  $Timer->stop( 'prepare list' );
  43  
  44  $Timer->start( 'display list' );
  45  
  46  // Note: since URLs are likely to be clean ASCII, $io_charset can probably be faked to UTF-8 here

  47  
  48  header( 'Content-type: application/xml; charset=UTF-8' );
  49  
  50  echo '<?xml version="1.0" encoding="UTF-8"?'.'>';
  51  ?>
  52  
  53  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  54  <?php
  55  while( $Item = & mainlist_get_item() )
  56  {    // For each blog post, do everything below up to the closing curly brace "}"
  57      ?>
  58      <url>
  59          <loc><?php $Item->permanent_url( 'single' ) ?></loc>
  60          <lastmod><?php $Item->mod_date( 'isoZ', true ) ?></lastmod>
  61          <priority>0.9</priority>
  62      </url>
  63      <?php
  64  } ?>
  65  </urlset>
  66  <?php
  67  
  68  $Timer->stop( 'display list' );
  69  
  70  $Hit->log(); // log the hit on this page

  71  
  72  // debug_info(); // output debug info if requested

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

  75  exit();
  76  ?>


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