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

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 11:44:11
Script start
Timing: Jan 18 2025 11:44:11
Module start 'layout'
Timing: Jan 18 2025 11:44:11
Module start 'content'
Timing: Jan 18 2025 11:44:12
Module end 'content'
Timing: Jan 18 2025 11:44:12
Script end

Main resources:

Total runtime0.9572 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 587.9219152.6250
Module start 'layout' 0.00500.0032 740.546939.4453
Module start 'content' 0.00820.9471 779.9922496.5859
Module end 'content' 0.95530.0018 1,276.578112.1563
Script end 0.9571  1,288.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.4717160.0003
Check MTime0.00210.2195160.0001
Mysql Total
Database connection0.00060.061310.0006
Mysqli_queries0.907194.7711540.0168
Looping result0.00060.0657520.0000
Template Total0.913495.420.4567
Template load0.00220.233620.0011
Template processing0.911195.190520.4556
Template load and register function0.00020.019710.0002
states
state_id_array0.00140.146610.0014
state_identifier_array0.00210.221220.0011
Override
Cache load0.00190.2005230.0001
Sytem overhead
Fetch class attribute can translate value0.00110.114320.0005
Fetch class attribute name0.00170.177520.0008
XML
Image XML parsing0.00030.032020.0002
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00070.0739100.0001
String conversion0.00000.001040.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs