How do I parse XML file from Wordpress for use in another CMS? The Next CEO of Stack OverflowHow does one parse XML files?How do I parse a string to a float or int in Python?How do I parse XML in Python?How do I get a YouTube video thumbnail from the YouTube API?How to parse JSON in JavaHow do I comment out a block of tags in XML?Why can't Python parse this JSON data?How Do You Parse and Process HTML/XML in PHP?PHP parse/syntax errors; and how to solve them?Wordpress XML Media Import with HTTP Authentication
Skipping indices in a product
How did the Bene Gesserit know how to make a Kwisatz Haderach?
Won the lottery - how do I keep the money?
Why am I allowed to create multiple unique pointers from a single object?
Is it my responsibility to learn a new technology in my own time my employer wants to implement?
What happened in Rome, when the western empire "fell"?
If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?
Why do we use the plural of movies in this phrase "We went to the movies last night."?
How to solve a differential equation with a term to a power?
Should I tutor a student who I know has cheated on their homework?
MessageLevel in QGIS3
Limits on contract work without pre-agreed price/contract (UK)
How to start emacs in "nothing" mode (`fundamental-mode`)
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
What does convergence in distribution "in the Gromov–Hausdorff" sense mean?
In excess I'm lethal
To not tell, not take, and not want
Can I equip Skullclamp on a creature I am sacrificing?
Can you replace a racial trait cantrip when leveling up?
Sending manuscript to multiple publishers
WOW air has ceased operation, can I get my tickets refunded?
Can I run my washing machine drain line into a condensate pump so it drains better?
How do I avoid eval and parse?
How do scammers retract money, while you can’t?
How do I parse XML file from Wordpress for use in another CMS?
The Next CEO of Stack OverflowHow does one parse XML files?How do I parse a string to a float or int in Python?How do I parse XML in Python?How do I get a YouTube video thumbnail from the YouTube API?How to parse JSON in JavaHow do I comment out a block of tags in XML?Why can't Python parse this JSON data?How Do You Parse and Process HTML/XML in PHP?PHP parse/syntax errors; and how to solve them?Wordpress XML Media Import with HTTP Authentication
I'm finding that the resources for doing this are sparse. I'm using MODX as a CMS and want to take my existing blogs from Wordpress and use them in the new CMS. The resources are abundant for going from MODX to WP, but there's only one published method for WP to MODX, using the Articles method, which unfortunately doesn't work anymore. Whether that is because Articles hasn't been updated or the XML file from WP is incompatible.
Anyway, I'm left now with trying to do this the old fashioned way and I will not be able to bring each article over one-by-one. I want to learn how to take the exported XML file from WP and parse it into MODX, probably using PHP. But I'm unsure where to start.
Any suggestions would be helpful...yes I tried Google already. I'm not sure what to start with.
Thanks!
php xml wordpress parsing modx
add a comment |
I'm finding that the resources for doing this are sparse. I'm using MODX as a CMS and want to take my existing blogs from Wordpress and use them in the new CMS. The resources are abundant for going from MODX to WP, but there's only one published method for WP to MODX, using the Articles method, which unfortunately doesn't work anymore. Whether that is because Articles hasn't been updated or the XML file from WP is incompatible.
Anyway, I'm left now with trying to do this the old fashioned way and I will not be able to bring each article over one-by-one. I want to learn how to take the exported XML file from WP and parse it into MODX, probably using PHP. But I'm unsure where to start.
Any suggestions would be helpful...yes I tried Google already. I'm not sure what to start with.
Thanks!
php xml wordpress parsing modx
add a comment |
I'm finding that the resources for doing this are sparse. I'm using MODX as a CMS and want to take my existing blogs from Wordpress and use them in the new CMS. The resources are abundant for going from MODX to WP, but there's only one published method for WP to MODX, using the Articles method, which unfortunately doesn't work anymore. Whether that is because Articles hasn't been updated or the XML file from WP is incompatible.
Anyway, I'm left now with trying to do this the old fashioned way and I will not be able to bring each article over one-by-one. I want to learn how to take the exported XML file from WP and parse it into MODX, probably using PHP. But I'm unsure where to start.
Any suggestions would be helpful...yes I tried Google already. I'm not sure what to start with.
Thanks!
php xml wordpress parsing modx
I'm finding that the resources for doing this are sparse. I'm using MODX as a CMS and want to take my existing blogs from Wordpress and use them in the new CMS. The resources are abundant for going from MODX to WP, but there's only one published method for WP to MODX, using the Articles method, which unfortunately doesn't work anymore. Whether that is because Articles hasn't been updated or the XML file from WP is incompatible.
Anyway, I'm left now with trying to do this the old fashioned way and I will not be able to bring each article over one-by-one. I want to learn how to take the exported XML file from WP and parse it into MODX, probably using PHP. But I'm unsure where to start.
Any suggestions would be helpful...yes I tried Google already. I'm not sure what to start with.
Thanks!
php xml wordpress parsing modx
php xml wordpress parsing modx
asked Mar 7 at 15:26
Jeff SydorJeff Sydor
297
297
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
getFeed snippet code can be helpful for you here. You can take it's code, modify a bit and process WP feed items, something like the next:
if (!empty($url) && $modx->getService('rss', 'xmlrss.modRSSParser')) {
$rss = $modx->rss->parse($url);
if (!empty($rss) && isset($rss->items))
while (list($itemKey, $item) = each($rss->items))
foreach ($item as $k => $v)
$item[$k] = str_replace(array('[',']'),array('[',']'),$item[$k]);
/// process rss items here
// f.e. add new modx resources
$newArticle = $this->modx->newObject('modResource'); //new article
$newArticle->set( 'template', ARTICLE_TEMPLATE_ID ); // replace ARTICLE_TEMPLATE_ID with actual article template id
$newArticle->set( 'pagetitle', $item['title'] ); // pagetitle
$newArticle->set( 'parent', ARTICLE_CONTAINTER_ID);
$newArticle->set( 'content', $item['description'] );
//add other valuable fields
if(!$newArticle->save())
// modx error
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047322%2fhow-do-i-parse-xml-file-from-wordpress-for-use-in-another-cms%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
getFeed snippet code can be helpful for you here. You can take it's code, modify a bit and process WP feed items, something like the next:
if (!empty($url) && $modx->getService('rss', 'xmlrss.modRSSParser')) {
$rss = $modx->rss->parse($url);
if (!empty($rss) && isset($rss->items))
while (list($itemKey, $item) = each($rss->items))
foreach ($item as $k => $v)
$item[$k] = str_replace(array('[',']'),array('[',']'),$item[$k]);
/// process rss items here
// f.e. add new modx resources
$newArticle = $this->modx->newObject('modResource'); //new article
$newArticle->set( 'template', ARTICLE_TEMPLATE_ID ); // replace ARTICLE_TEMPLATE_ID with actual article template id
$newArticle->set( 'pagetitle', $item['title'] ); // pagetitle
$newArticle->set( 'parent', ARTICLE_CONTAINTER_ID);
$newArticle->set( 'content', $item['description'] );
//add other valuable fields
if(!$newArticle->save())
// modx error
add a comment |
getFeed snippet code can be helpful for you here. You can take it's code, modify a bit and process WP feed items, something like the next:
if (!empty($url) && $modx->getService('rss', 'xmlrss.modRSSParser')) {
$rss = $modx->rss->parse($url);
if (!empty($rss) && isset($rss->items))
while (list($itemKey, $item) = each($rss->items))
foreach ($item as $k => $v)
$item[$k] = str_replace(array('[',']'),array('[',']'),$item[$k]);
/// process rss items here
// f.e. add new modx resources
$newArticle = $this->modx->newObject('modResource'); //new article
$newArticle->set( 'template', ARTICLE_TEMPLATE_ID ); // replace ARTICLE_TEMPLATE_ID with actual article template id
$newArticle->set( 'pagetitle', $item['title'] ); // pagetitle
$newArticle->set( 'parent', ARTICLE_CONTAINTER_ID);
$newArticle->set( 'content', $item['description'] );
//add other valuable fields
if(!$newArticle->save())
// modx error
add a comment |
getFeed snippet code can be helpful for you here. You can take it's code, modify a bit and process WP feed items, something like the next:
if (!empty($url) && $modx->getService('rss', 'xmlrss.modRSSParser')) {
$rss = $modx->rss->parse($url);
if (!empty($rss) && isset($rss->items))
while (list($itemKey, $item) = each($rss->items))
foreach ($item as $k => $v)
$item[$k] = str_replace(array('[',']'),array('[',']'),$item[$k]);
/// process rss items here
// f.e. add new modx resources
$newArticle = $this->modx->newObject('modResource'); //new article
$newArticle->set( 'template', ARTICLE_TEMPLATE_ID ); // replace ARTICLE_TEMPLATE_ID with actual article template id
$newArticle->set( 'pagetitle', $item['title'] ); // pagetitle
$newArticle->set( 'parent', ARTICLE_CONTAINTER_ID);
$newArticle->set( 'content', $item['description'] );
//add other valuable fields
if(!$newArticle->save())
// modx error
getFeed snippet code can be helpful for you here. You can take it's code, modify a bit and process WP feed items, something like the next:
if (!empty($url) && $modx->getService('rss', 'xmlrss.modRSSParser')) {
$rss = $modx->rss->parse($url);
if (!empty($rss) && isset($rss->items))
while (list($itemKey, $item) = each($rss->items))
foreach ($item as $k => $v)
$item[$k] = str_replace(array('[',']'),array('[',']'),$item[$k]);
/// process rss items here
// f.e. add new modx resources
$newArticle = $this->modx->newObject('modResource'); //new article
$newArticle->set( 'template', ARTICLE_TEMPLATE_ID ); // replace ARTICLE_TEMPLATE_ID with actual article template id
$newArticle->set( 'pagetitle', $item['title'] ); // pagetitle
$newArticle->set( 'parent', ARTICLE_CONTAINTER_ID);
$newArticle->set( 'content', $item['description'] );
//add other valuable fields
if(!$newArticle->save())
// modx error
answered Mar 16 at 12:08
Anton TarasovAnton Tarasov
312
312
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047322%2fhow-do-i-parse-xml-file-from-wordpress-for-use-in-another-cms%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown