Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
rafamp
Regular
Regular



Joined: Oct 15, 2005
Posts: 92
Location: Brazil

PostPosted: Thu Jan 12, 2006 7:19 am Reply with quote

hello people

2 things;

1-

i'm having some trouble with my rss feeds, since i use special caracters in my language like Ç, à, É and etc

Code:
http://www.gamerz.com.br/portal/backend.php


its because i use special caracters as i said.... the rss goes lame =/

backend code:

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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.       */
/************************************************************************/

include("mainfile.php");
global $prefix, $db, $nukeurl;
header("Content-Type: text/xml");
if (isset($cat) && !empty($cat)) {
   $cat = htmlentities($cat);
   list($catid) = $db->sql_fetchrow($db->sql_query("SELECT catid FROM ".$prefix."_stories_cat WHERE title LIKE '%$cat%' LIMIT 1"));
   if (empty($catid)) {
      $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10");
   } else {
      $catid = intval($catid);
      $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories WHERE catid='$catid' ORDER BY sid DESC LIMIT 10");
   }
} else {
   $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10");
}

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
echo "<rss version=\"0.91\">\n\n";
echo "<channel>\n";
echo "<title>".htmlentities($sitename)."</title>\n";
echo "<link>$nukeurl</link>\n";
echo "<description>".htmlentities($backend_title)."</description>\n";
echo "<language>$backend_language</language>\n\n";

while (list($rsid, $rtitle, $rtext) = $db->sql_fetchrow($result)) {
   $rsid = intval($rsid);
   echo "<item>\n";
   echo "<title>".htmlentities($rtitle)."</title>\n";
   echo "<link>$nukeurl/modules.php?name=News&amp;file=article&amp;sid=$rsid</link>\n";
   echo "<description>".htmlentities($rtext)."</description>\n";
   echo "</item>\n\n";
}
echo "</channel>\n";
echo "</rss>";

?>


2-

how can i limit the description tag to 200 characters?
 
View user's profile Send private message MSN Messenger
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Thu Jan 12, 2006 7:34 am Reply with quote

rafamp - I tihkn Susann had a similar problem with characters and if I remember correctly the backend.php from Nuke 7.9 seemed to work for her.
 
View user's profile Send private message Send e-mail
rafamp







PostPosted: Thu Jan 12, 2006 7:44 am Reply with quote

thx i'll give it a try
[ Only registered users can see links on this board! Get registered or login! ]

and the issue number 2?
 
Guardian2003







PostPosted: Thu Jan 12, 2006 7:55 am Reply with quote

2 - I have no idea
 
rafamp







PostPosted: Thu Jan 12, 2006 8:20 am Reply with quote

ok, the rss seems to work, in firefox rss reader it works like a charm, but, in the import rss function of IPB forum, it gets text like these:

Sega colocará demo jogável de "Full Auto" (X360) na Xbox Live

instead of:

Sega colocará demo jogável de "Full Auto" (X360) na Xbox Live

w3 validator see error:
[ Only registered users can see links on this board! Get registered or login! ]

i'm using 7.7 patched + 7.8 normal backend
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Jan 12, 2006 10:08 am Reply with quote

On #2, just do a truncate on $rtext before printing it. Something like

$rtext = substr($rtext, 0, 200); //http://us3.php.net/manual/en/function.substr.php
 
View user's profile Send private message
Susann
Moderator



Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Thu Jan 12, 2006 3:10 pm Reply with quote

rafamp have you ever used special characters for your pictures in news ? Munich is called in German München ? I used this word münchen-.jpg and found in my logfileanalyzer a lot of 404 errors for this images/m%c3%bcnchen.jpg.I did´t know this before because it was my first picture of munich. The easy solution is to use ue instead of ü.
 
View user's profile Send private message
rafamp







PostPosted: Thu Jan 12, 2006 4:49 pm Reply with quote

@ Raven,

in the backend file?


@ susan, i dont know.... i don't use images of my own site, i use external images Smile

buggy news:

Image

normal:]

Image

the thing is.... the problem is in my site, or in the other one?
 
Raven







PostPosted: Thu Jan 12, 2006 5:08 pm Reply with quote

Yes, just place that line of code above the line of code where it is used.
 
rafamp







PostPosted: Thu Jan 12, 2006 5:13 pm Reply with quote

raven the code is $rtext = $row['hometext'];

are u sure it is going to work?

edit

ok i discovered that my rss works like a charm, the problem is in the other site =/
[ Only registered users can see links on this board! Get registered or login! ]

put [ Only registered users can see links on this board! Get registered or login! ] and u will see Smile

anyone has any idea of how can i fix that in invision 2.0.9?

raven, my php code of backend.php

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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.       */
/************************************************************************/

include("mainfile.php");
include("includes/ipban.php");
global $prefix, $db, $nukeurl;
header("Content-Type: text/xml");
$cat = intval($cat);
if ($cat != "") {
   $catid = $db->sql_fetchrow($db->sql_query("SELECT catid FROM ".$prefix."_stories_cat WHERE title LIKE '%$cat%' LIMIT 1"));
   if ($catid == "") {
      $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10");
   } else {
      $catid = intval($catid);
      $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories WHERE catid='$catid' ORDER BY sid DESC LIMIT 10");
   }
} else {
   $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10");
}

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
echo "<rss version=\"0.91\">\n\n";
echo "<channel>\n";
echo "<title>".htmlspecialchars($sitename)."</title>\n";
echo "<link>$nukeurl</link>\n";
echo "<description>".htmlspecialchars($backend_title)."</description>\n";
echo "<language>$backend_language</language>\n\n";

while ($row = $db->sql_fetchrow($result)) {
   $rsid = intval($row['sid']);
   $rtitle = $row['title'];
   $rtext = $row['hometext'];
   echo "<item>\n";
   echo "<title>".htmlspecialchars($rtitle)."</title>\n";
   echo "<link>$nukeurl/modules.php?name=News&amp;file=article&amp;sid=$rsid</link>\n";
   echo "<description>".htmlspecialchars($rtext)."</description>\n";
   echo "</item>\n\n";
}
echo "</channel>\n";
echo "</rss>";

?>
 
Raven







PostPosted: Thu Jan 12, 2006 5:59 pm Reply with quote

Right before this line
echo "<description>".htmlspecialchars($rtext)."</description>\n";
 
rafamp







PostPosted: Thu Jan 12, 2006 6:15 pm Reply with quote

didn't worked raven =/

using:

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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.       */
/************************************************************************/

include("mainfile.php");
include("includes/ipban.php");
global $prefix, $db, $nukeurl;
header("Content-Type: text/xml");
$cat = intval($cat);
if ($cat != "") {
   $catid = $db->sql_fetchrow($db->sql_query("SELECT catid FROM ".$prefix."_stories_cat WHERE title LIKE '%$cat%' LIMIT 1"));
   if ($catid == "") {
      $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10");
   } else {
      $catid = intval($catid);
      $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories WHERE catid='$catid' ORDER BY sid DESC LIMIT 10");
   }
} else {
   $result = $db->sql_query("SELECT sid, title, hometext FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10");
}

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
echo "<rss version=\"0.91\">\n\n";
echo "<channel>\n";
echo "<title>".htmlspecialchars($sitename)."</title>\n";
echo "<link>$nukeurl</link>\n";
echo "<description>".htmlspecialchars($backend_title)."</description>\n";
echo "<language>$backend_language</language>\n\n";

while ($row = $db->sql_fetchrow($result)) {
   $rsid = intval($row['sid']);
   $rtitle = $row['title'];
   $rtext = substr($rtext, 0, 200); //http://us3.php.net/manual/en/function.substr.php
   echo "<item>\n";
   echo "<title>".htmlspecialchars($rtitle)."</title>\n";
   echo "<link>$nukeurl/modules.php?name=News&amp;file=article&amp;sid=$rsid</link>\n";
   echo "<description>".htmlspecialchars($rtext)."</description>\n";
   echo "</item>\n\n";
}
echo "</channel>\n";
echo "</rss>";

?>
 
Raven







PostPosted: Thu Jan 12, 2006 7:24 pm Reply with quote

$rtext = substr($rtext, 0, 200);

That code will truncate $rtext to 200 long.
 
rafamp







PostPosted: Fri Jan 13, 2006 6:24 am Reply with quote

ok i changed here:

echo "<description>".htmlspecialchars($rtext = substr($rtext, 0, 200))."</description>\n";

worked, thanks for help, all of u

now, another issue, how to appear in wich category is the title?

For example....

Downloads: Full Auto X360 DEMO

but in rss it just appears....

Full Auto X360 DEMO

i have tried to add without success =/
 
rafamp







PostPosted: Sat Jan 14, 2006 10:00 am Reply with quote

pleaseeeeeee
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©