Forums / Setup & design / How add object with custom main node?

How add object with custom main node?

Author Message

Andrey PAA

Saturday 08 April 2006 1:00:18 am

I have the main category:
Cat 1
Cat 2
Cat 3
and in main categories i hav any sub categories
i need that i select the main category than i click the button "create" (i do it)
then show the custom form for adding content object where showing the sub category of main category i.e.
Cat 1-1
Cat 1-2
Cat 1-3
and i can select only one (the radio button) (i do it)

the code of my template : edit_placement.tpl

<hr />
{$object.name} - {$node.name} - {$object.parent_nodes[0]}

{let children=fetch( content, tree,
        hash( parent_node_id, $object.parent_nodes[0],
	      class_filter_type,  'include',
              class_filter_array, array( '33' )  ) )
}
<table width="100%">
<tr>
<th>Main</th>
<th width="90%">Name</th>
</tr>


{def $cnt=0}
{foreach $children as $child}
{set $cnt=$cnt|inc(1)}
<tr>
<td> <input type="radio" name="MainNodeID" value="{$child.node_id}" id="my_{$child.node_id}" onChange='document.getElementById("hidmain").value={$child.node_id};' />

 </td>
<td><label for="my_{$child.node_id}">{$child.name} - {$cnt}</label></td>
</tr>
{/foreach}
{undef}    
<input id="hidmain" type="hidden" name="SetPlacementNodeIDArray[1]" value="" />
<input type="hidden" name="SetRemoteIDOrderMap[1]" value="1" />
<input type="hidden" name="SetRemoteIDFieldMap[1]" value="1" />

</table>
<hr />

 

then i click the button publish and the object is add to the system

but this object is placement in main category and in the sub category
but i need only sub category and without javascrpt
Help me please!

Andrey PAA

Saturday 08 April 2006 1:13:29 am

P.s.

code of "add button":

{* Grab main category. *}
{let children=fetch( content, tree,
        hash( parent_node_id, $view_parameters.root,
	      class_filter_type,  'include',
              class_filter_array, array( '33' )  ) )
}

{* $children *}{* LOOP: For each child of the node... *}
{foreach $children as $child}
    {* node_view_gui view=line content_node=$child *}
    <form method="post" action={"/content/action"|ezurl}>     
    <input type="hidden" name="NodeID" value="{$child.node_id}" />     
    <input type="hidden" name="ClassID" value="31" />     
    <input type="submit" name="NewButton" value="{'Create here'|i18n('design/standard/node/view')} in {$child.name|wash}" />   
    </form><br />
{/foreach}

{* End of namespace. *}
{/let}

and this code i dont't want to change