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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 10:20:52
Script start
Timing: Jan 18 2025 10:20:52
Module start 'layout'
Timing: Jan 18 2025 10:20:52
Module start 'content'
Timing: Jan 18 2025 10:20:53
Module end 'content'
Timing: Jan 18 2025 10:20:53
Script end

Main resources:

Total runtime0.5899 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 589.1563152.6406
Module start 'layout' 0.00570.0025 741.796939.4766
Module start 'content' 0.00810.5803 781.2734666.8125
Module end 'content' 0.58840.0014 1,448.085916.1250
Script end 0.5899  1,464.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.5752160.0002
Check MTime0.00140.2325160.0001
Mysql Total
Database connection0.00090.150910.0009
Mysqli_queries0.527089.3333730.0072
Looping result0.00080.1337710.0000
Template Total0.558394.620.2792
Template load0.00170.294320.0009
Template processing0.556694.345120.2783
Template load and register function0.00030.043410.0003
states
state_id_array0.00160.263810.0016
state_identifier_array0.00120.210420.0006
Override
Cache load0.00150.2524290.0001
Sytem overhead
Fetch class attribute can translate value0.00110.188740.0003
Fetch class attribute name0.00140.2412100.0001
XML
Image XML parsing0.00150.254640.0004
class_abstraction
Instantiating content class attribute0.00000.0032110.0000
General
dbfile0.00100.1649300.0000
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs