HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Importing News from RSS

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#57214 (In Topic #12444)
Avatar

Well-settled

I'm currently in the process of importing news from RSS.

It is in a way the continuation of this thread. :)

Import is working fine (besides the two facts mentioned in that thread, i.e. auto validation and strict syntax checking) but I have a few suggestions to make it even more powerful.

1) The contents of <description> xml tag should go inside News Article instead of News summary, since this is auto-created by the article itself. That's just an optional tweak of course since it's working fine as it is.

2) The author field should be filled by what's inside the <author> xml tag from the rss. That way the proper publisher will show instead of the member that did the import.

3) The date posted should be the same as the <pubDate> xml tag. Since this is an import, it should have the date/time the original article was posted instead of the date/time it was imported in my opinion.

If there are any suggestions on fixes for 2 & 3, that would be awesome. I'm guessing the changes would happen in cms_news.php?
Back to the top
 
Posted
Rating:
#57254
Avatar

Hi,

All good points - these changes have been done and will be incorporated into 4.3.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#57257
Avatar

Well-settled

That's great to know Chris, looks like 4.3 will be an awesome release!  :thumbs:

If changes have already been implemented, is there any chance you could post the changed cms_news.php file? (I'm guessing that's the one). I have around 2000 news posts waiting to be imported and that would be awesome beyond words to have them properly done so. :)
Back to the top
 
Posted
Rating:
#57258
Avatar

Sorry, there are other entangled changes here (not yet announced), it wouldn't really work.
4.3 RC3 shouldn't be long.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#57263
Avatar

Well-settled

That's ok, good to know they're coming anyway, can't wait for RC3 :)
Back to the top
 
Posted
Rating:
#57270
Avatar

Well-settled

I managed to import some news by creating an RSS file.

Some little things I have to report to help out improving this function.

When there's an error, you ALWAYS get the same screen, no matter what the error was.
Fatal error: Call to undefined function relay_error_mail() in /home7/metaltem/public_html/cms/pages/modules/cms_news.php on line 470

An error has occurred

PHP ERROR [1] Call to undefined function relay_error_mail() in /home7/metaltem/public_html/cms/pages/modules/cms_news.php on line 470 (version: 4.2.2, PHP version: 5.2.11, URL: /cms/cms_news/_import_news.htm?old_type=import)

Here is the stack trace:

Below is a stack trace revealing the state the software was in when the error occurred. If this represents a bug in the unmodified software, you may want to check Metal Temple website for a fix, and if there isn't one, report this as a bug. Please note that merely posting a stack trace is not sufficient for us to solve your problem; the stack trace is just an aid that presents us with additional information. We still need to know the error message, what you tried to do, how you tried to do it, version numbers, and any other appropriate information.
We apologise for this problem and if it's a bug we hope you will work with us so that we can fix it for you promptly.

File '/home7/metaltem/public_html/sources/failure.php'
Line '538'
Function 'get_html_trace'
Args

File '/home7/metaltem/public_html/sources/global2.php'
Line '807'
Function '_fatal_exit'
Args

'PHP ERROR [1] Call to undefined function relay_error_mail() in /home7/metaltem/public_html/cms/pages/modules/cms_news.php on line 470'


File '/home7/metaltem/public_html/sources/failure.php'
Line '147'
Function 'fatal_exit'
Args

'PHP ERROR [1] Call to undefined function relay_error_mail() in /home7/metaltem/public_html/cms/pages/modules/cms_news.php on line 470'


File '/home7/metaltem/public_html/sources/global2.php'
Line '678'
Function '_ocportal_error_handler'
Args

'error'

1

'Call to undefined function relay_error_mail()'

'/home7/metaltem/public_html/cms/pages/modules/cms_news.php'

470


File '/home7/metaltem/public_html/sources/global2.php'
Line '619'
Function 'ocportal_error_handler'
Args

1

'Call to undefined function relay_error_mail()'

'/home7/metaltem/public_html/cms/pages/modules/cms_news.php'

470


Function 'catch_fatal_errors'
Args


Some of the errors I tracked:

It doesn't like if there's the Word equivalents of ' , " or the - characters. Also it won't import if there's a . Maybe there should be a less strict method of importing news as well since many copy paste their articles from Word documents. :)
Back to the top
 
Posted
Rating:
#57292
Avatar

Hi,

That stack trace looks very familiar- we have fixed the bug at some point, so it should definitely be fixed in 4.3 RC3 when that is out.
As you observed it is an error you only see if there is some other error. I think the fix is simply to remove the 'relay_error_mail' line from the cms_news.php file, as it shouldn't have been in there.

With regards the anomalous characters, I suspect it is a feed encoding problem. Windows will often use the incorrect character set for these kinds of symbols even when claiming to be using the standard character set (in fact, I think the characters it uses aren't in the standard ISO-8859-1 character set). In normal usage (i.e. manually adding news), ocPortal will do substitutions for these, but I don't think it does it for import, as it is likely assuming the claimed character set of the feed is gospel here.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#57316
Avatar

Well-settled

Thanks for the reply Chris!

Maybe OC Portal's function for replacing the notoriously problem-causing Word characters should be invoked while importing as well, just a suggestion if it's not too much trouble, for future usage. :)

Unfortunately many people do straight copy/paste from Word documents on platforms that don't convert them to standard ISO characters.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: