Author |
Message |
rafamp
Regular


Joined: Oct 15, 2005
Posts: 92
Location: Brazil
|
Posted:
Thu Jan 12, 2006 7:19 am |
|
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&file=article&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? |
|
|
|
 |
Guardian2003
Site Admin

Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Thu Jan 12, 2006 7:34 am |
|
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. |
|
|
|
 |
rafamp

|
Posted:
Thu Jan 12, 2006 7:44 am |
|
|
|
 |
Guardian2003

|
Posted:
Thu Jan 12, 2006 7:55 am |
|
|
|
 |
rafamp

|
Posted:
Thu Jan 12, 2006 8:20 am |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Thu Jan 12, 2006 10:08 am |
|
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 |
|
|
|
 |
Susann
Moderator

Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Thu Jan 12, 2006 3:10 pm |
|
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 ü. |
|
|
|
 |
rafamp

|
Posted:
Thu Jan 12, 2006 4:49 pm |
|
@ Raven,
in the backend file?
@ susan, i dont know.... i don't use images of my own site, i use external images
buggy news:
Only registered users can see links on this board! Get registered or login!
normal:]
Only registered users can see links on this board! Get registered or login!
the thing is.... the problem is in my site, or in the other one? |
|
|
|
 |
Raven

|
Posted:
Thu Jan 12, 2006 5:08 pm |
|
Yes, just place that line of code above the line of code where it is used. |
|
|
|
 |
rafamp

|
Posted:
Thu Jan 12, 2006 5:13 pm |
|
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 =/
http://www.rss-info.com/en_rssinclude-simple.html
put http://www.gamerz.com.br/portal/backend.php and u will see
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&file=article&sid=$rsid</link>\n";
echo "<description>".htmlspecialchars($rtext)."</description>\n";
echo "</item>\n\n";
}
echo "</channel>\n";
echo "</rss>";
?>
|
|
|
|
|
 |
Raven

|
Posted:
Thu Jan 12, 2006 5:59 pm |
|
Right before this line
echo "<description>".htmlspecialchars($rtext)."</description>\n"; |
|
|
|
 |
rafamp

|
Posted:
Thu Jan 12, 2006 6:15 pm |
|
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&file=article&sid=$rsid</link>\n";
echo "<description>".htmlspecialchars($rtext)."</description>\n";
echo "</item>\n\n";
}
echo "</channel>\n";
echo "</rss>";
?>
|
|
|
|
|
 |
Raven

|
Posted:
Thu Jan 12, 2006 7:24 pm |
|
$rtext = substr($rtext, 0, 200);
That code will truncate $rtext to 200 long. |
|
|
|
 |
rafamp

|
Posted:
Fri Jan 13, 2006 6:24 am |
|
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

|
Posted:
Sat Jan 14, 2006 10:00 am |
|
|
|
 |
|