Forums / Developer / powercontent and object relation

powercontent and object relation

Author Message

val Mbuyi

Friday 27 February 2009 12:54:53 am

Hi,
I use the extension powercontent but I have a problem with object related.
I use the following syntax for a comment related to his parents but unfortunately the form fields without the ablum which is an object related

<input name="powercontent_album_ContentObjectAttribute_data_object_relation_list_pcattributeid[]" value="{$node.object.id}" type="hidden">


By sending the form, all fields are filled except the fields of the object related.
So my question is whether the object related powercontent works well or it will add the datatype?
Remember, in the list of coming with different datatypes powercontent I can see nowhere this datatype
What can i do?

Romain Bremaud

Tuesday 05 April 2011 12:46:03 am

Hi.

I have the same problem, I use the following code for resolve it (this solution is for a Dropdown list) .

In a first time I fecth the class

{def $myclass = fetch( 'content', 'class', hash( 'class_id', 42 ) )}

I copied and adapted the code present in edit/ezobjectrelationlist.tpl

{let class_content=$myclass.data_map.my_attribute.content}

{let parent_node=cond( and( is_set( $class_content.default_placement.node_id ),

$class_content.default_placement.node_id|eq( 0 )|not ),

$class_content.default_placement.node_id, 1 )

nodesList=cond( and( is_set( $class_content.class_constraint_list ), $class_content.class_constraint_list|count|ne( 0 ) ),

fetch( content, tree,

hash( parent_node_id, $parent_node,

class_filter_type,'include',

class_filter_array, $class_content.class_constraint_list,

sort_by, array( 'name',true() ),

main_node_only, true() ) ),

fetch( content, list,

hash( parent_node_id, $parent_node,

sort_by, array( 'name', true() )

) ))}

And finally I write the dropdow list :

<div class="buttonblock">

<input name="single_select_{$attribute.id}" value="1" />

<select name="powercontent_my_attribute_ContentObjectAttribute_data_object_relation_list_pcattributeid[]">

{if $attribute.contentclass_attribute.is_required|not}

<option value="no_relation" {if eq( $attribute.content.relation_list|count, 0 )} selected="selected"{/if}>{'No relation'|i18n( 'design/standard/content/datatype' )}</option>

{/if}

{section var=node loop=$nodesList}

<option value="{$node.contentobject_id}"

{if ne( count( $attribute.content.relation_list ), 0)}

{foreach $attribute.content.relation_list as $item}

{if eq( $item.contentobject_id, $node.contentobject_id )}

selected="selected"

{break}

{/if}

{/foreach}

{/if}

> 

{$node.name|wash}</option>

{/section}

</select>

</div>

It works for me.

Romain

Romain Bremaud
Les clefs du net

eZ debug

Timing: Jan 30 2025 19:33:23
Script start
Timing: Jan 30 2025 19:33:23
Module start 'content'
Timing: Jan 30 2025 19:33:23
Module end 'content'
Timing: Jan 30 2025 19:33:23
Script end

Main resources:

Total runtime0.2119 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.9375370.2891
Module start 'content' 0.00650.0151 958.22661,001.5469
Module end 'content' 0.02160.1902 1,959.77343,890.7109
Script end 0.2118  5,850.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00421.9759200.0002
Check MTime0.00120.5809200.0001
Mysql Total
Database connection0.00060.293610.0006
Mysqli_queries0.112152.90401410.0008
Looping result0.00130.60831390.0000
Template Total0.189889.610.1898
Template load0.00070.321510.0007
Template processing0.189189.268310.1891
Override
Cache load0.00050.227010.0005
Sytem overhead
Fetch class attribute can translate value0.00160.776010.0016
XML
Image XML parsing0.00020.110510.0002
General
dbfile0.01949.1427200.0010
String conversion0.00000.001830.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