Forums / General / Sort children by class

Sort children by class

Author Message

Franck T.

Monday 03 October 2005 8:09:02 am

Hello,
I have this structure (with classes created to fit my needs):

-Department
-- Employee John
-- Employee Suzan
-- Employee Richard
--- Service A
--- Service C
--- Service B

I'd like to create a new full view of my class Department (id 29), where employees (id 30) and services (id 31) would be sorted and separated by a line <hr>, like this:

-Department
-- Employee John
-- Employee Richard
-- Employee Suzan
<hr />
--- Service A
--- Service B
--- Service C

I've tried with <b>class_identifier</b> but it doesn't work.
Thanks in advance for your help.

Kristof Coomans

Monday 03 October 2005 10:43:10 am

Can you post the code you've tried to use?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Franck T.

Tuesday 04 October 2005 12:12:41 am

Hello Kristof.
This was my original full view:

{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                          sort_by,        $node.sort_array ))}

    <table class="in_departement">
        {section name=Child loop=$children}
            <tr>
                <td>
                    <a href={$:item.url_alias|ezurl}>{$:item.name}</a> 
                </td>
           </tr>
        {/section}
    </table>

{/let}

I turn it into this:

{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                          sort_by,        $node.sort_array ))}
										  
	<table class="employees">
		{section var=emp loop=$children}
			{section show=$emp.class_identifier | eq('Employee')}
				<tr>
					<td>
						<a href= {$emp.url_alias|ezurl}> {$emp.name|wash} </a>
					</td>
				</tr>
			{/section}
		{/section}
	</table>	
	<hr />
	<table class="services">
		{section var=serv loop=$children}
			{section show=$serv.class_identifier | eq('Service')}
				<tr>
					<td>
						<a href= {$serv.url_alias|ezurl}> {$serv.name|wash} </a>
					</td>
				</tr>
			{/section}
		{/section}
	</table>	
	
									  
{/let}

... but it return nothing !

Franck T.

Wednesday 05 October 2005 11:30:26 pm

No idea? Really...?

Kristof Coomans

Thursday 06 October 2005 7:07:05 am

All characters of a class identifier are lowercase. Your check however assumes that the first character is uppercase.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Franck T.

Thursday 06 October 2005 12:11:42 pm

Arrrghh...What I call a killing detail !!
Thanks Kristof. You're simply the best !