Forums / General / Changing content layout, having some trouble

Changing content layout, having some trouble

Author Message

Christian Johansen

Monday 22 September 2008 6:35:56 am

I'm changing my content structure, and most imnportantly, I'm changing main node for alot of nodes. This is a manual job, and that's fine.

I have articles with comments as children nodes. My problem is that when I switch main node for an article, all the comments belong to the article node in the "old" main position. Is there anyway I can automate, or atleast script, the following?

- Loop all article objects
- For each article, check all nodes (locations)
- Move any child nodes of articles to the article object main node

Sorry if it's unclear. I really don't want to do this manually, especially since I cannot move more than one node at a time...

André R.

Monday 22 September 2008 6:49:23 am

Why do you move them by using node location?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Monday 22 September 2008 12:45:53 pm

Why would you change main node of an object a lot, especially if contains lots of child nodes?

Anyways, it seems to me that this should be definitely achievable with eZ API, the logic seems quite straightforward, and it could be in form of a cronjob or an action for which an extra button would be added in the admin interface. You would have to consider performance issues, though. Unless it is a couple of comments per thread, this could be quite an exhaustive operation, especially as a cronjob.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Gaetano Giunta

Monday 22 September 2008 3:06:25 pm

not exactly a magic solution, but at least there is an extension that adds a "move all selected nodes" button in the admin interface, right next to the "delete selected nodes".
It goes a long way in making such tasks easier

Principal Consultant International Business
Member of the Community Project Board

Gaetano Giunta

Monday 22 September 2008 3:08:10 pm

ps: as André pointed out, if you use "move", by default all children will follow. Can you use that functionality instead of swapping node location of the container object itself?

Principal Consultant International Business
Member of the Community Project Board

Christian Johansen

Tuesday 23 September 2008 4:14:35 am

Cool, I'll check out the extension, it will help alot.

The reason I'm doing this through locations is that all the articles already have what will be the new main location as a secondary location. I'm moving from having nodes primarily positioned on dates and secondary on tags to the other way around. Since the nodes already have the locations, this is alot simpler to do.

Christian Johansen

Tuesday 23 September 2008 5:45:44 am

This extension makes this doable: http://ez.no/developer/contribs/template_plugins/multi_node_functions

Thanks alot for that! I can't for the life of me understand why there isn't such functionality in eZP already, I've longed for it many a time before :) Or a dropdown with actions, like in Gmail.