Valentin Svelland
|
Wednesday 30 July 2003 1:29:04 am
I've made a new class called "employees" for listing co-workers and their telephonenumbers and so on. However I can't list more than 8 of these employees in my line_employees.tpl. I've tried to override my standard folder.tpl with a folder_class_16.tpl for this new employees-class but no luck so far. I also must mention that my folder.tpl is rewritten to show article in full view if only one instance present in a given folder. If two or more they're listed using the corresponding line.tpl-file:
CODE FROM MY FOLDER.TPL :
---------------------
{* Now decide what to do *} {switch name=decision match=$articles_count}
{* If only one article in folder: display this in full article view *}
{case match=1}
{* Show this if there is only one article! E.g. include the "full article view" page. *}
{section name=Article loop=$articles}
{node_view_gui view=full content_node=$decision:Article:item}
{/section} {/case}
{* If two or more articles: display this according to "line_article.tpl"-view *}
{case}
{section name=Article loop=fetch(content, list, hash(
parent_node_id, $node.node_id,
limit, 8,
offset, $view_parameters.offset,
sort_by, $node.sort_array,
class_filter_type, exclude,
class_filter_array, array( 1, 10 ) ) )} {node_view_gui view=line content_node=$decision:Article:item}
{/section}
{/case}
{/switch} ---------------------- How do I list different number of elements from the articles and the employees classes?
|
Valentin Svelland
|
Thursday 31 July 2003 12:26:19 am
My solution at this time is to do a section check for the particular node id for the page where I list my employees in the beginning of folder.tpl. Don't know if this is sexy coding, but at least it works.
FOLDER.TPL: -------------------------
{section name=employee show=eq($node.node_id,204)}
<h1>Our employees - alphabetically</h1>
{section name=Article loop=fetch(content, list, hash(
parent_node_id, $node.node_id,
limit, 9999,
offset, $view_parameters.offset,
sort_by, $node.sort_array,
class_filter_type, exclude,
class_filter_array, array( 1, 10 ) ) )}
{node_view_gui view=line content_node=$employee:Article:item} {/section} {section-else}
{* Get the articles (ClassID: "2"! Might be different for you!) *} {let articles=fetch('content','list',hash(parent_node_id,$node.node_id,class_filter_type,"include",class_filter_array,array(2)))}
{* Get a count of the articles (ClassID: "2"! Might be different for you!) in this folder. *} {let articles_count=fetch('content','list_count',hash(parent_node_id,$node.node_id,class_filter_type,"include",class_filter_array,array(2)))}
{* Now decide what to do *} {switch name=decision match=$articles_count}
{* If only one article in folder: display this in full article view *}
{case match=1}
{* Show this if there is only one article! E.g. include the "full article view" page. *}
{section name=Article loop=$articles}
{node_view_gui view=full content_node=$decision:Article:item}
{/section} {/case}
{* If two or more articles: display this according to "line_article.tpl"-view *}
{case}
{section name=Article loop=fetch(content, list, hash(
parent_node_id, $node.node_id,
limit, 8,
offset, $view_parameters.offset,
sort_by, $node.sort_array,
class_filter_type, exclude,
class_filter_array, array( 1, 10 ) ) )} {node_view_gui view=line content_node=$decision:Article:item}
{/section}
{/case} {/switch} {/section}
|