Joomla! Discussion Forums



It is currently Sun Nov 22, 2009 3:07 am (All times are UTC )

 




Post new topic Reply to topic  [ 157 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
Posted: Sat Feb 04, 2006 4:19 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Feb 04, 2006 3:38 am
Posts: 7
Wow that was fast. Thanks The Mc.

I added the following code, but I thought I would run it by you before getting the db messy. It doesnt look quite right, but I dont really know:

'". $maintext . "

Our Affiliate'


Top
  E-mail  
 
Posted: Sat Feb 04, 2006 3:39 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Feb 04, 2006 3:38 am
Posts: 7
Well that little code didnt work.  Anyone know how to reference an affiliate in maintext?


Top
  E-mail  
 
Posted: Wed Feb 08, 2006 4:47 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 01, 2005 5:02 pm
Posts: 11
Location: Queens NY
I must have misunderstood you.  If you want the reference to an affiliate in the maintext I am unable to help, as this info is pulled from the feed itself.

_________________
ACO - AntiCulture.Org


Top
   
 
Posted: Mon Feb 13, 2006 8:15 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Feb 13, 2006 8:09 am
Posts: 6
Thanks for a fantastic script.

Onyl problem I have found is that most RSS feeds have a content:encoded tag to get the full description.

I have changed the script slightly (thanks to Sebastian), as follows, but I still dont get it to post the full feed.


****************************************************
                $introtext = str_stop(addslashes($item['description']), 280); //Shorten
description to 280 chars...
                $maintext = addslashes($item['content:encoded']);
****************************************************

Any further ideas?


Top
   
 
Posted: Tue Feb 14, 2006 3:26 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 14, 2006 12:55 am
Posts: 3
Hi everyone, I read most of the post in the topic and finally got the news feeds in the database, but still have 2 problems.

1. It only fetches the description of the feed and its saved in the intro text and main text, Haydn you said you imported the whole article. Can you explain how you did this?

2. Even if the articles are already as content items with the right section and category, I can not get them to be displayed when going through the web page. Any ideas?


Top
  E-mail  
 
Posted: Tue Feb 14, 2006 3:33 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 01, 2005 5:02 pm
Posts: 11
Location: Queens NY
Can't help with number 1, because I want/need that functionality also and haven't been able to accomplish it!

Can you be clearer on number 2?  You said it imports but you do not see it, do you mean on the front page or in the section you have it set to go to?

_________________
ACO - AntiCulture.Org


Top
   
 
Posted: Tue Feb 14, 2006 3:35 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Sun Aug 21, 2005 9:02 am
Posts: 96
fedeglez wrote:
Hi everyone, I read most of the post in the topic and finally got the news feeds in the database, but still have 2 problems.

1. It only fetches the description of the feed and its saved in the intro text and main text, Haydn you said you imported the whole article. Can you explain how you did this?

2. Even if the articles are already as content items with the right section and category, I can not get them to be displayed when going through the web page. Any ideas?

Hi fedeglez,
1) Its only possible to import only the information that appears in the actual xml file feed (do save as and see it foryourself with notepad)

2)  Can you see them in backend, if so they sounds like they are being imported as not published or something like that. Create an article manually and compare SQL fields between the auto imported articles and the manually created one (using something like phpMyAdmin).

Cheers,
Max


Top
  E-mail  
 
Posted: Tue Feb 14, 2006 5:02 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 14, 2006 12:55 am
Posts: 3
First thank you very much for the quick replay.

Ok, I can see the content items in the back end and they are published. I also checked the database with phpmyadmin and there isn't any difference with the manually created articles and the ones imported with the script.

But one funny thing happened. Until now I have imported several different feeds and now have around 80 content items in the database, when I was importing the 3ed or 4th feed I can suddenly see the first feed in the frontend. But the rest of them I still cannot see them in the frontend.


Top
  E-mail  
 
Posted: Tue Feb 14, 2006 5:12 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Sun Aug 21, 2005 9:02 am
Posts: 96
Sounds like you are viewing them in the front end incorrectly, try publishing a menu link to the section/category and see if you can browse them that way.


Top
  E-mail  
 
Posted: Tue Feb 14, 2006 6:38 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 08, 2005 6:58 pm
Posts: 27
Are you trying to have all the feeds published directly to the front page?  If so, you can do this by changing the ordering of the "Home" page.  Move it down a position and put your feed category first.  This will result in the feeds being published on your main entry page.


Top
  E-mail  
 
Posted: Tue Feb 14, 2006 7:27 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sun Nov 20, 2005 5:58 pm
Posts: 28






';

/**
* INSERT DATA
*/
// VERY IMPORTANT, changes will be required here for sure!

    // THE attribs below are specific to my site but you can blank it all if you wish (default parameters)
// with attribs, make sure to type each on new line (ie line break as shown below otherwise mambo will not understand it)

    // Ordering number, be fault it will be #99, i am yet to implement an auto detection as mambo/joomla does on its own
// for now all articles will be #99 so when publishing sort them by published date
    @mysql_query("
INSERT INTO jos_content (
title,
introtext,
`fulltext`,
state,
sectionid,
mask,
catid,
created,
created_by,
checked_out,
publish_up,
attribs,
version,
access,
ordering
) VALUES (
'". $titletext ."',
'". $introtext ."',
'". $maintext ."',
'1',
'7',
'0',
'38',
'". $publishdate ."',
'62',
'0',
'". $publishdate ."',
'introtext=0
createdate=1',
'1',
'0',
'99'
)
",$obj_db) or die(mysql_error());

        }
    }

if ($obj_db) {
    @mysql_close($obj_db);
}

// if we have downloaded new feeds, lets create a report for the admin
if ($feed_summary)
{

// runtime check, to tell admin on how long this script has been running, might be handy to know
$mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime;

/** EMAIL variables */
$email_subject = 'Your subject here';
$email_body = '

Hello
It has been a real frustration for me in getting the script work. I have below my rss2joomla.php file - please advise if I got variables right (my database info are fake) or anything wrong in the configuartion that the script is not working.

I do not get any error (just a blank screen which I gather is a good sign) when call the script from the browser. I have pear and rss.php installed on my server.

I am really at loss why I do not get anything entered in content and my database. I will apprecaite any help. This will help few other members who got exactly the same problem
Quote:
// Sample RSS feeds to Joomla / Mambo importing script, hacked together by Max Soukhomlinov, maxs@intellectit.com.au
//
// This script requires XML_RSS and PHP Pear Libraries
//
// There is an issue on some shared hosting sites that this will fail if ran via cron however if browsed to, it works just fine.
// this has to do with permissions, your hosting website uid does not have same rights as apache uid (under which script is executed when your browse to it)
// I am at the moment trying to work out a solution to it, if you can think of something that will help, please drop me a line.
// Happy importing :-)
//

/** the PEAR XML_RSS object/class is required */
require '/usr/share/pear/XML/RSS.php';

/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","myusername"); //DB username here
define("DB_PASSWD","mypassword"); // DB password here
define("DB_DATABASE","mydatabase"); //DB name here

/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.cnn.com/rss/cnn_topstories.rss'); //Insert your URL here
//$rss_feed = & new XML_RSS('feed.xml'); //Used this for testing with local file, a bit quicker

// Change to your email address, if you do not want notifications, rem out line 187.
$admin_email = 'admin.accb@gmail.com';

// Should not need to change anything from here onwards unless you know some basic php
// The advanced options are: A) Alter title formatting (lines 68 and 84);
//  B) Alter introtext/maintext formatting (lines 85 and 86);
//  C) Change formatting of notification email (lines 92-97 for per new item formatting and 164-182 for main body formatting).

// Next two lines are for duration runtime, which is reported via email
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];

// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
  if (strlen($string) > $max_length){
      $string = substr($string, 0, $max_length);
      $pos = strrpos($string, " ");
      if($pos === false) {return substr($string, 0, $max_length)."...";}
      return substr($string, 0, $pos)."...";
  }else{return $string;}
}


/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());

/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());

$rss_feed->parse();

$num_articles=0; //Variable used to count number of new articles, displayed in an email below

    // Here we make sure that feed articles do not already exist in DB
    // this uses title names, make sure to use the same title formatting here as you will use further down
    // state = 1 not trashed
    foreach ($rss_feed->getItems() as $item) {
        $obj_query = @mysql_query("
            SELECT
                COUNT(id) AS link_match
            FROM
                jos_content
            WHERE
                title = '". str_stop(addslashes($item['title']),100) ."'
AND
state = '1'
        ",$obj_db) or die(mysql_error());

        $int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());

        mysql_free_result($obj_query);

        if ($int_count['link_match'] == 0) {

    $num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/

$titletext = str_stop(addslashes($item['title']),100);
$introtext = str_stop(addslashes($item['description']), 280); //Shorten description to 280 chars...
$maintext = addslashes($item['description']);
$publishdate = date('Y-m-d H:i:s', strtotime($item['pubdate'])); //Convert feed article publish date to mambo publish date
$publishdate_readable =  date('d-m-Y, H:i', strtotime($item['pubdate'])); // I didnt like the standard date format, this is for email field

    // the following used to notify admin of new articles (via email), this is parsed with each article
$feed_summary .= '
'. $publishdate_readable .' '. $titletext .' '. $introtext .' '. $maintext .'

 
   
   
   
   
 
  '. $feed_summary .'
 

 
DateHeadingIntro textFull text

This message was automatically generated by the rss importing process on your website.


Script: '. getcwd() .'/yourscriptnamehere.php

RSS Feed source: http://www.theregister.co.uk/headlines.rss

Current date: '. date(r) .'

Script execution time: '. round($totaltime,3) .' seconds.


';

$from = "MIME-Version: 1.0\n";
$from .= "Content-type: text/html; charset=iso-8859-1\n";
$from .= "From: From Address name \n";
mail($admin_email, $email_subject, $email_body, $from);

}
?>



Top
   
 
Posted: Tue Feb 14, 2006 8:10 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Feb 13, 2006 8:09 am
Posts: 6
typera wrote:
[1) Its only possible to import only the information that appears in the actual xml file feed (do save as and see it foryourself with notepad)


However with some  newsreaders you can view the [content:encoded] part of the feed, without having to go to the full article via weblink.

Therefore the question is, how can you import the information with the [content:encoded] tag via this script? It must be possible given that a newsreader can access this information.

Thoughts?


Top
   
 
Posted: Tue Feb 14, 2006 8:47 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 14, 2006 12:55 am
Posts: 3
typera wrote:
Sounds like you are viewing them in the front end incorrectly, try publishing a menu link to the section/category and see if you can browse them that way.


It's all right now, it just seems to take a while for me to be able to see the content items on the front end. I came back a few hours later and now I can see everything.

thanks anyway for your help.


Top
  E-mail  
 
Posted: Wed Feb 15, 2006 12:58 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Feb 04, 2006 3:38 am
Posts: 7
Does anyone out there know how to cause the script to add a static link to each article pulled in?  "Visit our Affiliates" It would be great to have an affiliate link placed in each intro.  Great for SEO and affilliate programs


:P


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 5:38 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jan 14, 2006 7:37 am
Posts: 15
Hello All,
I have a wired problem importing RSS 2 Joomla on my most important RSS import.  The Error message is:
Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in /home/sierrale/public_html/scripts/rss2joomla.php on line 95

This script works for other imports but this one 

Here is the RSS
'http://allafrica.com/tools/headlines/rdf/sierraleone/headlines.rdf '

Any help will be appreciated.
Dee.


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 1:58 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 08, 2005 6:58 pm
Posts: 27
Dee:  I'm not sure where you are going wrong.  I got the feeds that you are trying to use to work.
Have a look yourself.
http://www.newsnabber.com/scripts/morocco.php
http://www.newsnabber.com/scripts/nigeria.php
http://www.newsnabber.com/scripts/egypt.php

The resulting feeds are then posted to this url,

http://www.newsnabber.com/index.php?opt ... &Itemid=30


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 2:19 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jan 14, 2006 7:37 am
Posts: 15
Wow,
I went through your links and saw that the news were uploaded correctly.  I am very jealous.. lol.  It seems as if for http://allafrica.com/tools/headlines/rd ... dlines.rdf the date functions:

$publishdate = date('Y-m-d H:i:s', strtotime($item['pubdate'])); //Convert feed article publish date to mambo publish date
$publishdate_readable =  date('d-m-Y, H:i', strtotime($item['pubdate'])); // I didnt like the standard date format, this is for email field

are not working properly.  I tried printing out the date variables $publishdate and $publishdate_readable and they both printed out "1969"

Please help...

Dee.


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 2:46 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 08, 2005 6:58 pm
Posts: 27

       
       
       
       
       
        ';

                /**
                * INSERT DATA
                */
                // VERY IMPORTANT, changes will be required here for sure!

    // THE attribs below are specific to my site but you can blank it all if you wish (default parameters)
                // with attribs, make sure to type each on new line (ie line break as shown below otherwise mambo will not understand it)

    // Ordering number, be fault it will be #99, i am yet to implement an auto detection as mambo/joomla does on its own
                // for now all articles will be #99 so when publishing sort them by published date
    @mysql_query("
                        INSERT INTO jos_content (
                                title,
                                introtext,
                                `fulltext`,
                                state,
                                sectionid,
                                mask,
                                catid,
                                created,
                                created_by,
                                checked_out,
                                publish_up,
                                attribs,
                                version,
                                access,
                                ordering

                        ) VALUES (
                                '". $titletext ."',
                                '". $introtext ."',
                                '". $maintext . "

Read more...',
                                '1',
                                '8',
                                '0',
                                '18',
                                '". $publishdate ."',
                                '62',
                                '0',
                                '". $publishdate ."',
                                'introtext=0
                                createdate=1',
                                '1',
                                '0',
                                '99'
                        )
                ",$obj_db) or die(mysql_error());

        }
    }

if ($obj_db) {
    @mysql_close($obj_db);
}

// if we have downloaded new feeds, lets create a report for the admin
if ($feed_summary)
{

// runtime check, to tell admin on how long this script has been running, might be handy to know
$mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime;

/** EMAIL variables */
$email_subject = 'Your subject here';
$email_body = '

Here is a copy of the exact script I use.  Please pay attention to the areas in Red

// Sample RSS feeds to Joomla / Mambo importing script, hacked together by Max Soukhomlinov, maxs@intellectit.com.au
//
// This script requires XML_RSS and PHP Pear Libraries
//
// There is an issue on some shared hosting sites that this will fail if ran via cron however if browsed to, it works just fine.
// this has to do with permissions, your hosting website uid does not have same rights as apache uid (under which script is executed when your browse to it)
// I am at the moment trying to work out a solution to it, if you can think of something that will help, please drop me a line.
// Happy importing :-)
//

/** the PEAR XML_RSS object/class is required */
require 'XML/RSS.php';

/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","change this"); //DB username here
define("DB_PASSWD","change this"); // DB password here
define("DB_DATABASE","change this"); //DB name here

/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://allafrica.com/tools/headlines/rdf/egypt/headlines.rdf'); //Insert your URL here
//$rss_feed = & new XML_RSS('feed.xml'); //Used this for testing with local file, a bit quicker

// Change to your email address, if you do not want notifications, rem out line 187.
$admin_email = 'youraddress@yourdomain.com';

// Should not need to change anything from here onwards unless you know some basic php
// The advanced options are: A) Alter title formatting (lines 68 and 84);
//  B) Alter introtext/maintext formatting (lines 85 and 86);
//  C) Change formatting of notification email (lines 92-97 for per new item formatting and 164-182 for main body formatting).

// Next two lines are for duration runtime, which is reported via email
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];

// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
  if (strlen($string) > $max_length){
      $string = substr($string, 0, $max_length);
      $pos = strrpos($string, " ");
      if($pos === false) {return substr($string, 0, $max_length)."...";}
      return substr($string, 0, $pos)."...";
  }else{return $string;}
}


/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());

/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());

$rss_feed->parse();

                $num_articles=0; //Variable used to count number of new articles, displayed in an email below

    // Here we make sure that feed articles do not already exist in DB
    // this uses title names, make sure to use the same title formatting here as you will use further down
    // state = 1 not trashed
    foreach ($rss_feed->getItems() as $item) {
        $obj_query = @mysql_query("
            SELECT
                COUNT(id) AS link_match
            FROM
                jos_content
            WHERE
                title = '". str_stop(addslashes($item['title']),100) ."'
                        AND
                                state = '1'
        ",$obj_db) or die(mysql_error());

        $int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());

        mysql_free_result($obj_query);

        if ($int_count['link_match'] == 0) {

                    $num_articles = $num_articles +1;
                        /**
                        * REFORMATTING CODE
                        **/

                $titletext = str_stop(addslashes($item['title']),100);
                $introtext = str_stop(addslashes($item['description']), 280); //Shorten description to 280 chars...
                $maintext = addslashes($item['description']);
                $publishdate = date('Y-m-d H:i:s', strtotime($item['pubdate'])); //Convert feed article publish date to mambo publish date
                $publishdate_readable =  date('d-m-Y, H:i', strtotime($item['pubdate'])); // I didnt like the standard date format, this is for email field
                                $link = addslashes($item['link']); // Marty added this line


    // the following used to notify admin of new articles (via email), this is parsed with each article
                $feed_summary .= '
       
'. $publishdate_readable .''. $titletext .''. $introtext .''. $maintext .'

 
   
   
   
   
 
  '. $feed_summary .'
 
       
 
DateHeadingIntro textFull text

        This message was automatically generated by the rss importing process on your website.


        Script: '. getcwd() .'/egypt.php

        RSS Feed source: http://allafrica.com/tools/headlines/rdf/egypt/headlines.rdf

        Current date: '. date(r) .'

        Script execution time: '. round($totaltime,3) .' seconds.
       


';

$from = "MIME-Version: 1.0\n";
$from .= "Content-type: text/html; charset=iso-8859-1\n";
$from .= "From: From Address name \n";
mail($admin_email, $email_subject, $email_body, $from);

}
echo $email_body;
?>

Top
  E-mail  
 
Posted: Fri Feb 17, 2006 5:41 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jan 14, 2006 7:37 am
Posts: 15
Thanks for your help "hospital", I still got an error.. I will try using your RSS, but when I use Sierra Leone I get these errors below.

Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in /home/sierrale/public_html/scripts/rss2joomla.php on line 87

Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in /home/sierrale/public_html/scripts/rss2joomla.php on line 88
Date Heading Intro text Full text
31-12-1969, 17:59 Obj Hosts Kuffor, Kabbah At Abuja Investment Forum PRESIDENT Olusegun Obasanjo will on February 20-21, host Presidents John Kuffor of Ghana and Ahmad Jejan Kabbah of Sierra Leone, when he declares open the West African Investment Forum (WAIF) at Abuja, Federal Capital Territory. PRESIDENT Olusegun Obasanjo will on February 20-21, host Presidents John Kuffor of Ghana and Ahmad Jejan Kabbah of Sierra Leone, when he declares open the West African Investment Forum (WAIF) at Abuja, Federal Capital Territory.
This message was automatically generated by the rss importing process on your website.

Script: /home/sierrale/public_html/scripts/SaLone.php
RSS Feed source: http://allafrica.com/tools/headlines/rd ... dlines.rdf
Current date: Fri, 17 Feb 2006 11:38:40 -0600
Script execution time: 0.121 seconds.


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 5:48 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jan 14, 2006 7:37 am
Posts: 15
Hospital, I just tried your script as suggested using Egypt. and I got the same error with my dates being "1969".  I think it probably has to do with the date conversion function on my system.  But why does it work for some other RSS?


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 5:52 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 08, 2005 6:58 pm
Posts: 27
I've got no idea at this point on what the problem may be.


Top
  E-mail  
 
Posted: Fri Feb 17, 2006 11:48 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Nov 14, 2005 10:17 pm
Posts: 26
Nevermind user error ;)

All fixed :)


Last edited by nmau on Sat Feb 18, 2006 10:46 am, edited 1 time in total.

Top
  E-mail  
 
Posted: Tue Feb 21, 2006 3:23 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jan 14, 2006 7:37 am
Posts: 15
Hello All,
I spoke with my Host and they told me that it could very well be that the RSS2Joomla script was written to run on PHP4.  My web site is hosted on a server that runs PHP5.  I know these two lines are causing the problem, because when I do an echo on the $publishdate and $publishdate_readable variables I get a date like "31-12-1969, 17:59".

$publishdate = date('Y-m-d H:i:s', strtotime($item['pubdate'])); //Convert feed article publish date to mambo publish date
$publishdate_readable =  date('d-m-Y, H:i', strtotime($item['pubdate'])); // I didnt like the standard date format, this is for email field

Does anyone know how to re-write this two lines to be PHP5 compliant?

Thanks,
Dee.


Top
  E-mail  
 
Posted: Tue Feb 21, 2006 8:10 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 21, 2006 8:01 pm
Posts: 2
Thx to All. The script works perfect (after litel bit changes) on http://www.n-admin.com/bc44-44.html
I had a problems with russian encoding.

at line 52, after:

@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());

we added:

mysql_query("SET CHARACTER SET 'cp1251'");

and we also changed the script for converting UTF-8 to cp1251

_________________
N-Admin.com - The Best Site for IT Administrators. Administrating Microsoft / Unix / Linux Systems.


Top
  E-mail  
 
Posted: Wed Feb 22, 2006 4:06 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Jan 31, 2006 8:53 am
Posts: 25
This looks great - haven't been able to get it to work yet though. Here's my problem(s)

1) no Pear RSS stuff on my server. In discussions with my provider to get it. In the meantime, I've uploaded RSS.php and Parser.php to the same directory as rss2joomla.php. I'm getting the following output:

package.xml XML_RSS RSS parser Parser for Resource Description Framework (RDF) Site Summary (RSS) documents. MJ Martin Jansen mj@php.net lead 0.9.9 2005-10-22 PHP License beta This release is a beta release in preparation for the upcoming stable release of version 1.0.0. * Allows string inputs (useful for cached feeds, e.g. from databases) * Fixes dependency on XML_Parser and removes erroneous dependency on XML_Tree * Fixed bug #557 * Fixed bug #2045 * Fixed bug #2310 * Fixed bug #2782 * Fixed bug #3871 * Added unit tests XML_Parser 0.9.2 2003-03-13 stable * Added support for the RSS modules Dublin Core Metadata and blogChannel * Big parts of the parsing engine have been rewritten 0.9 2002-01-11 stable This is the inital stable release. 0.9.1 2002-04-11 stable This release fixes a small bug that caused warnings when using a verbose error mode in PHP. XML_RSS-0.9.9/RSS.php100755 1750 1750 24424 10245162256 7356

Now, this is some of the comments from RSS.php. Needless to say the script isn't working, and I imagine it's because RSS.php isn't working. I've tried changing the comment type, but I think I'm going fundamentally wrong.

I'm guessing that the answer is "get your provider to install the pear RSS.php stuff", but I'd love to hear other suggestions. Thanks.

***edit*** yes, the answer was "get your provider to install the pear RSS.php stuff". It's working now. Except, I have one problem...when the new content comes in, it has a "read more..." link at the bottom. This link takes the user to MY site, the "main text" portion, not to the website the RSS feed came from. I want them to go to the original source. Help!


Last edited by splankin on Wed Feb 22, 2006 8:00 pm, edited 1 time in total.

Top
   
 
Posted: Fri Feb 24, 2006 7:46 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Jan 27, 2006 6:36 am
Posts: 17
Script works great...took me a while to figure out where to put RSS.php and Parser.php, but it's fantastic. Thanks to the author and to those that have posted some modifications to improve it already. Looking forward to how it can be extended in the future.


Top
   
 
Posted: Fri Feb 24, 2006 2:40 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Nov 08, 2005 6:58 pm
Posts: 27
splankin:

Just download the XML file http://www.mambothemes.com/XML.zip

Unzip it and upload the XML folder with it's files in the folder where you have your script(s).
--/
--/--scripts/
--/--scripts/--XML
--/--scripts/--my.script.php

That should do the trick


Top
  E-mail  
 
Posted: Mon Feb 27, 2006 12:48 pm 
User avatar
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Oct 25, 2005 1:02 pm
Posts: 1
Location: Austin, Texas
just wanted to add a quick note concerning parsing additional xml tags.

if you want to grab the tag and throw it into the author alias for the entry, you must make the following changes:

in your RSS.php, make sure the tag you are looking for exists in this array:
Code:
var $itemTags = array('TITLE', 'LINK', 'DESCRIPTION', 'PUBDATE', 'AUTHOR');

(the file I downloaded with this script did not have the AUTHOR entry here)

then add this to the reformatting code in your import script:
Code:
$author = addslashes($item['author']);


now you just need to make the following changes to your SQL statement:
Code:
@mysql_query("
         INSERT INTO jos_content (
            title,
            introtext,
            `fulltext`,
            state,
            sectionid,
            mask,
            catid,
            created,
            created_by,
            created_by_alias,
            checked_out,
            publish_up,
            attribs,
            version,
            access,
            ordering
         ) VALUES (
            '". $titletext ."',
            '". $introtext ."',
             '". $maintext . "<br><br><a href=". $link ." target=_blank  class=readon>Original Story</a>',
            '1',
            '14',
            '0',
            '56',
            '". $publishdate ."',
            '62',
            '". $author ."',
            '0',
            '". $publishdate ."',
            'introtext=0
            createdate=1',
            '1',
            '0',
            '99'
         )


then just add this to your $feed_summary:
Code:
<td>'. $author.'</td>


and this to your output table:
Code:
<th bgcolor="#FFFFFF">Author</th>


that should do it

-raoult

_________________
.: illperipherals.net :.
.: all things sick and connected :.


Top
   
 
Posted: Tue Feb 28, 2006 8:27 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Feb 08, 2006 8:26 pm
Posts: 17
I'm getting a Restricted access error.. I've chmod the rss.phpp to 755 but still get the error and the rss2joomla.php is 755 also.

Glen,


Top
   
 
Posted: Wed Mar 01, 2006 3:33 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Feb 08, 2006 8:26 pm
Posts: 17
Ok I have it working now  but i'm not getting the "readmore" to pull the remainder of hte article i'm only getting the short description.

http://howtogetahead.net/articles/hot_t ... esses.html


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 157 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

Quick reply

 



Who is online

Users browsing this forum: No registered users and 7 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group