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.

eZ debug

Timing: Jan 18 2025 02:53:22
Script start
Timing: Jan 18 2025 02:53:22
Module start 'content'
Timing: Jan 18 2025 02:53:22
Module end 'content'
Timing: Jan 18 2025 02:53:22
Script end

Main resources:

Total runtime0.1272 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 589.2656180.8203
Module start 'content' 0.00520.0061 770.0859101.8984
Module end 'content' 0.01130.1158 871.9844530.6250
Script end 0.1271  1,402.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.6678200.0002
Check MTime0.00131.0375200.0001
Mysql Total
Database connection0.00070.514910.0007
Mysqli_queries0.081664.15571410.0006
Looping result0.00110.87001390.0000
Template Total0.115490.710.1154
Template load0.00080.651010.0008
Template processing0.114690.077410.1146
Override
Cache load0.00060.463910.0006
Sytem overhead
Fetch class attribute can translate value0.00060.455310.0006
XML
Image XML parsing0.00020.191010.0002
General
dbfile0.00826.4260200.0004
String conversion0.00000.004530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs