Import RSS news to the blog
Import RSS news to the blog
I tried from "Admin -> Import data -> Generic RSS Import" to import news from external RSS news feeds, and it is working fine by creating every news as a new entry (this is what I want).
I need to use this feature regularly. Is there a way I can put this function in the cron job?
The entries make by this function is not putting the original URL of the news in the body, How can I modify the script to insert the original news URL to the body?
Thank you,
I need to use this feature regularly. Is there a way I can put this function in the cron job?
The entries make by this function is not putting the original URL of the news in the body, How can I modify the script to insert the original news URL to the body?
Thank you,
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Import RSS news to the blog
Hi!
What you seem to want to use is not the Generic RSS import, but the "Aggregator plugin", which can be set by a cronjob. Have a look and download it from spartacus.s9y.org.
That plugin also contains a template patch for using the original URL of a posting.
Regards,
Garvin
What you seem to want to use is not the Generic RSS import, but the "Aggregator plugin", which can be set by a cronjob. Have a look and download it from spartacus.s9y.org.
That plugin also contains a template patch for using the original URL of a posting.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
The .diff file just lists lines that are removed frmo the original template with a "-" prefix, and lines added to that with a "+" prefix. So you could manually apply the changes.
There are alsu GNU Patchutils / Diffutils out there, which you might want to google up.
Best regards,
Garvin
The .diff file just lists lines that are removed frmo the original template with a "-" prefix, and lines added to that with a "+" prefix. So you could manually apply the changes.
There are alsu GNU Patchutils / Diffutils out there, which you might want to google up.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Sure, here is the patched entries.tpl file, using the "templates/default/entries.tpl" as the source:
http://nopaste.php-q.net/214886
Regards,
Garvin
http://nopaste.php-q.net/214886
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Thank you very much for that codes. It works fine for me.
I need the following points to be fixed before I go live with my site:
1) I need to put the Original URL ($entry.properties.ep_aggregator_articleurl) to the post content
2) I want the Aggregated posts to be in the draft mode (not published)
How can I do these?
I need the following points to be fixed before I go live with my site:
1) I need to put the Original URL ($entry.properties.ep_aggregator_articleurl) to the post content
2) I want the Aggregated posts to be in the draft mode (not published)
How can I do these?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
1.) Then just move that variable to wherever you need it inside the entries.tpl file. Search for $entry.body and put it next to it?
2.) That is not possible with the current plugin. Why do you want that? Then you would need to approve every single article, you know that?
To patch this you would need to edit the serendipity_event_aggregator.php file and search for :
Just replace that "false" near "isdraft" with "true":
Best regards,
Garvin
1.) Then just move that variable to wherever you need it inside the entries.tpl file. Search for $entry.body and put it next to it?
2.) That is not possible with the current plugin. Why do you want that? Then you would need to approve every single article, you know that?
To patch this you would need to edit the serendipity_event_aggregator.php file and search for :
Code: Select all
$entry = array('id' => $ep_id,
'title' => $item['title'],
'timestamp' => $item['date'],
'extended' => '',
'isdraft' => 'false',
'allow_comments' => 'false',
'categories' => $feed['categoryids'],
'author' => $feed['feedname'],
'authorid' => $feed_authorid);
Code: Select all
$entry = array('id' => $ep_id,
'title' => $item['title'],
'timestamp' => $item['date'],
'extended' => '',
'isdraft' => 'true',
'allow_comments' => 'false',
'categories' => $feed['categoryids'],
'author' => $feed['feedname'],
'authorid' => $feed_authorid);
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Ah. That cannot be done, you need to preview your entry to view the original URL in that case.
Else you'd need to modify the aggregator plugin PHP code to put the original URL into the body.
BTW, if you use categories for putting your aggregated feeds, you can see by the category from which Site an entry comes.
Regards,
Garvin
Ah. That cannot be done, you need to preview your entry to view the original URL in that case.
Else you'd need to modify the aggregator plugin PHP code to put the original URL into the body.
BTW, if you use categories for putting your aggregated feeds, you can see by the category from which Site an entry comes.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
For that, you would need to look at the plugin. Look for where the "ep_*" things are inserted into the database, and instead of doing that, append the variables that are inserted into the entry's body.
You'll definitely learn some PHP along the way, so this is a very good example of learning by doing. The task at hand is not so hard, so I'm sure with some trial and error you'll succeed.
If not, you still have the option of using the category system like I outlined.
The other way is, if you can manage to convince me why anyone (or you specifically) need the feed's URL in the admin section, I might create the patch for you as an official option to the plugin.
Best regards,
Garvin
For that, you would need to look at the plugin. Look for where the "ep_*" things are inserted into the database, and instead of doing that, append the variables that are inserted into the entry's body.
You'll definitely learn some PHP along the way, so this is a very good example of learning by doing. The task at hand is not so hard, so I'm sure with some trial and error you'll succeed.
If not, you still have the option of using the category system like I outlined.
The other way is, if you can manage to convince me why anyone (or you specifically) need the feed's URL in the admin section, I might create the patch for you as an official option to the plugin.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Oophs, that is too difficult for me to edit that file.
Well let me try to convince you..
If you remember that I wanted the aggregated post to be in the draft mode (not to publish immediately) this feature is also related to the same, I want to approve every posts to my Blog, so when the script aggregated the articles it will be in the draft mode so I will go to every article and approve them or delete them, when approving if I need to know more about that particular article I need to go to the original URL to read them, that is the reason I want the original URL to appear in the admin area.
Hope I convinced you?
Well let me try to convince you..
If you remember that I wanted the aggregated post to be in the draft mode (not to publish immediately) this feature is also related to the same, I want to approve every posts to my Blog, so when the script aggregated the articles it will be in the draft mode so I will go to every article and approve them or delete them, when approving if I need to know more about that particular article I need to go to the original URL to read them, that is the reason I want the original URL to appear in the admin area.
Hope I convinced you?
Well, for your own purposes (at least for the moment), you could try this:
Open the file serendipity_event_aggregator.php. Find this code:
Earlier in the code, we got the content and put it into $entry['body']. We'll just add the link at the top, before we go saving it. There's only one line to add, and the result should look like this:
Perhaps not my most elegant code ever, but it should accomplish what you want.
Open the file serendipity_event_aggregator.php. Find this code:
Code: Select all
$feed['articleurl'] = $item['link'];
// Store as property
$entryid = serendipity_updertEntry($entry);
$this->insertProperties($entryid, $feed, $md5hash);
printf(" Save '%s' as %s.\n", $item['title'], $entryid);
Code: Select all
$feed['articleurl'] = $item['link'];
$entry['body'] = 'Original article at <a href="' . $item['link'] . '">' . $item['link'] . '</a>' . "\n";
// Store as property
$entryid = serendipity_updertEntry($entry);
$this->insertProperties($entryid, $feed, $md5hash);
printf(" Save '%s' as %s.\n", $item['title'], $entryid);
RSS feeds not shown on index. HOW?
What do I need to do to automatically not show posts from rss feeds on the index page and only in the category where it is placed ?
What file do I need to edit and more importanly what do I need to add so the posts from the rss aggregator aren't shown on the index page.
Like if you add a new entery and choose the option :
Hide from article overview / frontpage
Can you help me?
What file do I need to edit and more importanly what do I need to add so the posts from the rss aggregator aren't shown on the index page.
Like if you add a new entery and choose the option :
Hide from article overview / frontpage
Can you help me?