Flux RSS

Répondre
Partager Rechercher
Badworm peux-tu réclamer un flux RSS pour les NEWS section PS ?

C'est pour disposer en haut du site des LSD à la place du flux RSS actuel qui est en anglais.
Visible ici

Ça ferais un peu de pub pour le site de news de JOL liés à PS qui est largement sous-visité...
Peut-être que je me trompe mais il est possible que tu n'aie qu'a activer la fonctionnalité qui peut-être se trouve déjà présente dans le portail utilisé pour poster les news.
Dois-je me renseigner directement ou bien préfères-tu le faire toi même ?
Je ne peux qu'ajouter des nouvelles.

Il est plus simple que tu t'adresses directement aux personnes s'occupant du site. De plus, je préfère éviter de m'investir dans un truc dont j'ignore totalement le fonctionnement, j'ai déjà assez de mal à gérer mes activités comme ça,... Navré.
Citation :
Publié par Toonman
Elle est revenue mais comme c'est la première chose qu'elle a vu elle a failli faire une attaque.
Une attaque ? Elle à vu quoi ? Je pige pas...

Dans tous les cas c'est prévu ou pas du tout ? A priori personne n'est motivé pour le mettre en place c'est ça non ?
Le temps lui manque et elle ne connait pas.

De plus j'ai posté une demande de recrutement d'un webmaster et j'ai reçu un nombre impressionnant de MP qui avoisinait les 0.

Je vais donc demander l'aide de webmestres exterieures à PS.

Et moi je suis motivé pour le mettre en place...
Citation :
Publié par Toonman
Le temps lui manque et elle ne connait pas.
Je vais donc demander l'aide de webmestres exterieures à PS.
Et moi je suis motivé pour le mettre en place...
Tu es donc motivé pour le mettre en place, ça c'est une bonne nouvelle.
Citation :
Publié par No_One
Tu es donc motivé pour le mettre en place, ça c'est une bonne nouvelle.


je t'aime toi

erf t'es NC, ça va pas coller entre nous
__________________
SouNourS, Chef des Frenchies, meilleure OUTFIT (TR-FR) de WERNER (facile, on est les seul )
http://valid.x86-secret.com/cache/banner/334109.png
http://sigs.planetsidestats.net/1/21/373206/sig
http://www.madcappers.co.uk/SigMaker/werner/373206.jpg
Cela n'a pas l'air de bouger cette histoire...
C'est dommage...
Il existe cependant des moyens simple de mettre en place un flux XML :
Monsieur ou Madame le webmestre compétant devrait comprendre ce qui suit sinon il va falloir se former !

Code:
<?php
/*
    instantRSS.php

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    (or you can peep it here: http://www.gnu.org/licenses/gpl.txt)
*/
/* DESCRIPTION                                                                */
/* instantRSS is a simple RSS creator for folks who don't have RSS capability */
/* for their site/blog/whatever.  As long as a page is marked up appropriately*/
/* with the <!--instantRSS:xxxxx--> tags, then instantRSS can spit out an RSS */
/* file!                                                                      */

/* instantRSS can be used two ways: remotely or locally.  both methods of     */
/* of usage will return the same output.                                      */

/* Remote usage implies that the instantRSS script resides on a server that   */
/* does not host your site/blog. This is handy for folks that don't have any  */
/* type of scripting on their hosts, or just don't want to fool with it.  If  */
/* you'd like to use thelocust.org's instantRSS script to generate your RSS   */
/* then check out instantRSS's site listed above for the url to use           */

/* Local usage implies that the instantRSS script resides on the same server  */
/* that hosts your site, and that instantRSS script is used *only* for your   */
/* instantRSS marked pages.                                                   */  

/* In either case, to give instantRSS a URL to parse:                         */
/* http://yourblog.com/instantRSS.php?url=http://yourblog.com/index.html      */
/* just specify the page to get the RSS from in the url= variable in the URL  */
/* (replacing yourblog.com with the name of the server with instantRSS on it) */

/* instantRSS markup tags                                                     */
/* i'm not going to explain RSS here, because i assume you already know what  */
/* all that is about. http://voidstar.com/rssfaq should provide more info.    */

/* all instantRSS tags are in this format: <!--instantRSS:xxxxx--> where      */
/* xxxxx is the name of the tag.                                              */

/* example instantRSS markup */
/*
<!--instantRSS:beginchantitle-->
  Ben's Blog
<!--instantRSS:endchantitle-->

<!--instantRSS:beginchanlink-->
  http://thelocust.org
<!--instantRSS:endchanlink-->

<!--instantRSS:beginchandesc-->
  the blog of ben wilson
<!--instantRSS:endchandesc-->

<!--instantRSS:beginitem-->
      <!--instantRSS:begintitle-->
        February 11, 2003
      <!--instantRSS:endtitle-->

      <!--instantRSS:beginlink-->
      <!--http://thelocust.org?newsid=364-->
      <!--instantRSS:endlink-->

      <!--instantRSS:begindesc-->
        Man, I've got SO MUCH news today!  The sun is shining!
      <!--instantRSS:enddesc-->
<!--instantRSS:enditem-->

*/

/* instantRSS will use whatever is in between the two corresponding tags      */
/* as the value for that tag.  for instance, the channel title in the above   */
/* example is "Ben's Blog".  instantRSS will also take values in HTML comments*/
/* as seen in the item link tag in the example above.  This allows you to hide*/
/* values so that they are not see on your actual site.  This may be done with*/
/* ANY valid instantRSS tag.  When outputting that hidden value, the <!-- and */
/* --> header and footer will be removed automagically.                       */

/* instantRSS TAGS */

/* CHANNEL TAGS                                                               */
/* title - (beginchantitle / endchantitle).  if instantRSS fails to find this */
/*   tag, it will attempt to find and use the <title></title> tag which is    */
/*   found in the <header></header> of most pages.                            */
/* link  - (beginchanlink / endchanlink). if instantRSS fails to find this    */
/*   tag, it will use the link passed to it via the URL variable.             */
/* desc  - (beginchandesc / endchandesc). if instantRSS fails to find this tag*/
/*   it will attempt to use the META description tag found on many pages in   */
/*   in the <header>. e.g.:                                                   */
/*   <meta name="description" content="AE4RV.com is....">                     */

/* ITEM TAGS                                                                  */
/* item - (beginitem / enditem). Note that each item must begin and end with  */
/*   the corresponding tag.  all item sub-tags must be within the beginning   */
/*   and ending item tags                                                     */
/* item title - (begintitle / endtitle)                                       */
/* item link  - (beginlink / endlink)                                         */
/* item desc  - (begindesc / enddesc)                                         */


/* NOTES */

/* HTML will be stripped out of ALL tag values, unless specified through the  */
/* HTML variable as such:                                                     */
/*   http://yoursite.com/instantRSS.php?url=http://thelocust.org&html=1       */
/* There are 3 possible values for HTML=:                                     */
/*   0 - no HTML in RSS output                                                */
/*   1 - any and all HTML in RSS                                              */ 
/*   2 - escaped HTML in RSS (spaces become %20, etc)                         */ 

/* HOW TO LINK TO IT */
/* http://yourserver.com/instantRSS.php?url=http://yourserver.com/index.html  */


/* HACKING NOTES */
/* You want to hack on this and send me a patch?  AWESOME.  Send your changes */
/* (in a patch or as the whole file) to ben[at]thelocust[dot]org              */
/* Please use spaces instead of tabs when indenting.  Tabs are the work of    */
/* the devil.                                                                 */





/* CONFIGURATION                                                              */

/* URL RESTRICTION                                                            */

/* set bRestrictURL to 1 to restrict instantRSS to ONLY parsing URLs from the */
/* $sValidURL list. If $bRestrictURL is 0, then whatever is passed to instant */
/* RSS in the URL variable will be parsed.  use at your own risk!!            */
$bRestrictURL = 0;


/* set arrValidURL to the URLs that instantRSS is allowed to accept. use commas */
/* to delimit. i.e. array("thelocust.org","ae4rv.com");                       */
/* please note that this should ALWAYS be at least defined like:              */
/* $arrValidURL = array();                                                    */
/* even if it is empty.                                                       */
//$arrValidURL = array();
$arrValidURL = array("thelocust.org","ae4rv.com");
//$arrValidURL = array();



/* set iHTMLLevel to set the level of HTML compatibility.                     */
/*   0 - no HTML in RSS output                                                */
/*   1 - any and all HTML in RSS                                              */ 
/*   2 - escaped HTML in RSS (spaces become %20, etc)                         */ 
/* NOTE: setting this variable will override an value passed in the URL.      */
/*   leave it commented out (with "//") to not set it.                        */ 
//$iHTMLLevel = 0;


if (!isset($iHTMLLevel) && isset($_GET['html']))
  $iHTMLLevel = $_GET['html'];
else
  $iHTMLLevel = 0;

if (isset($_GET['url'])) {
  $URL = $_GET['url'];
  if (substr($URL,0,7) != 'http://') {
    $bFailure = TRUE;
    echo "<BR>The URL you have provided '$URL' does not start with http://, and it should!";
  }
  else {
    $tmp = explode("/",substr($URL,7,strlen($URL)-7));
    if ( is_array($arrValidURL) ) {
      if ( !in_array($tmp[0],$arrValidURL) && $bRestrictURL == 1  ) {
        $bFailure = TRUE;
        echo "<BR>The URL specified (<a href=\"$URL\">$URL</a>) is not in the list of valid server URLs!";
      } 
    }
    else {
      echo "<BR>You MUST initialize the $arrValidURL array, even if it is to be empty.";
    }
  }
}
else
  $URL = "";


if ($bFailure)
     echo "<br><br>FAILURE!<br>Some sort of horribly catastrophic failure has occured.  See the above error messages for details.";
else {
  //read into an array lines from the URL
  $file = file($URL);

  //make sure the file read was successfull
  if (!$file)
    echo("The URL you have given me either contains no data or could not be read.<br>".
	 "<a href=\"$URL\">Click here</a> to go to the URL you specified.");
  else {

    $file = implode("",$file);
    $itemtags = array('title','link','desc');
    $items = array();

    //first up, split the page using the begin item tag as a delimiter
    //thus, we will have an array with the beginning of the page as index 0,
    //the first item at 1...
    $arrfile = explode('<!--instantRSS:beginitem-->',$file);

    //find CHANNEL TITLE
    $tmp = split("<!--instantRSS:beginchantitle-->",$arrfile[0]);
    $tmp = split("<!--instantRSS:endchantitle-->",$tmp[1]);
    if (strlen($tmp[0]))
      $channeltitle = stripHTML($tmp[0]);
    else {
      $tmp = split("<title>",$arrfile[0]);
      $tmp = split("</title>",$tmp[1]);
      $channeltitle = stripHTML($tmp[0]);
    }

    //find CHANNEL DESC
    $tmp = split("<!--instantRSS:beginchandesc-->",$arrfile[0]);
    $tmp = split("<!--instantRSS:endchandesc-->",$tmp[1]);
    if (strlen($tmp[0]))
      $channeldesc = stripHTML($tmp[0]);
    else {
      $tmp = split("<meta name=\"description\" content=\"",$arrfile[0]);
      $tmp = split("\">",$tmp[1]);
      $channeldesc = stripHTML($tmp[0]);
    }

    //find CHANNEL LINK
    $tmp = split("<!--instantRSS:beginchanlink-->",$arrfile[0]);
    $tmp = split("<!--instantRSS:endchanlink-->",$tmp[1]);
    if (strlen($tmp[0]))
      $channellink = stripHTML($tmp[0]);
    else
      $channellink = stripHTML($URL);



    //for each item in the array, starting with index of 1
    for ($i=1;$i<=sizeof($arrfile);$i++) {

      $items[$i] = array();

      //take the item, and split it using the enditem tag as delimiter
      //this will give us an array with the actual item in index 0, and the leftover 
      //crap in index 1
      $item = explode('<!--instantRSS:enditem-->',$arrfile[$i]);

      //set the item to the item text in index 0
      $item = $item[0];

      //for each tag in "itemtags"
      for ($x=0;$x<sizeof($itemtags);$x++) {
        //take this cleaned up item, and split it using the begin tag as delimiter
        //leaving us with an array with the title+restofitem in index 1
        $arritem = explode("<!--instantRSS:begin$itemtags[$x]-->",$item);
        
        //if we didn't find a begin title tag, then set the title to item #X
        //else splie the title+restofitem using the endtitle tag!
        if ( sizeof($arritem) <= 1 ) {
          if ($itemtags[$x] == 'link')
	    $items[$i][$x] = $URL;
          elseif ($itemtags[$x] == 'title')
            $items[$i][$x] = "item #$i";
          elseif ($itemtags[$x] == 'desc')
            $items[$i][$x] = "no description";
        } //if sizeof
        else {
          $tmp = explode("<!--instantRSS:end$itemtags[$x]-->",$arritem[1]);
          $items[$i][$x] = stripHTML($tmp[0]);
        } //if sizeof else
      }  //for sizeof itemtags

    } //for each newsitem



/* START OUTPUT */

if (!headers_sent()) {

//print the XML header so the browser or whatever is picking this up
//will know wtf it is!
if (!isset($_GET['debug']))
  header ("content-type: text/xml");
print '<?xml version="1.0"?>';

?>

<!--
RSS generated by instantRSS (http://thelocust.org/projects/instantrss) 
for <?=$channeltitle?> (<?=$channellink?>)
at <?=date('r')?>

-->
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title><?=$channeltitle?></title>
<link><?=$channellink?></link>
<description><?=$channeldesc?></description>


<?php
  //start individual ITEMs

  //for each item, again
  for($j=1;$j<sizeof($items);$j++) {
?>

<item>
  <title><?=$items[$j][0]?></title>        
  <link><?=$items[$j][1]?></link>        
  <description><?=$items[$j][2]?></description>        
</item>

<?php
    } //end for items

?>
</channel>
</rss>

<?php
	} //if headers sent

  } //if file was good


} // if a URL has been specified


function stripHTML($string) {
  global $iHTMLLevel;

  $string = trim(str_replace("-->","",str_replace("<!--","",$string)));

  
  
  //escape HTML
  if ($iHTMLLevel == 2)                            //escapeHTML
    $string = urlencode(htmlentities($string));
  elseif ($iHTMLLevel == 1)                        //leave HTML alone
    $string = $string;
  elseif ($iHTMLLevel == 0 || !isset($iHTMLLevel)) //strip all HTML
    $string = str_replace('&','&amp;',rssencode(htmlentities(strip_tags($string))));
  
  //return a trimmed, un-HTML-commented string
  return $string;
}


//rss encoding function
//from http://www.pmichaud.com/examples/pmwiki/rss.php
//Copyright 2002-2004 Patrick R. Michaud (pmichaud@pobox.com)  
function rssencode($s) 
{ return preg_replace('/([\\x80-\\xff])/e',"'&#'.ord('\$1').';'",$s); }

?>
Si JOL ne mets pas en place ce flux il y a un autre moyen de récupérer leur news... Si vous disposez de la fonction fopen() activée sur votre serveur (cf php.ini) il est possible de syndiquer leur news via php. Enfin c'est un autre sujet...
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés