Friday 22 April 2005 12:01:42 pm
Hey Joanie,
Fyi this is a side step reply to Joanie Chembars'
http://ez.no/community/forum/general/3_4_4_showing_user_posted_article_links_on_profile_page But the forums won't let anyone reply to it because of a forum thread reply template subject length bug (ez crew ...) I too saw Paul's contribution today and though it would be fun to test drive it ;) What I'd to use it was override the default design/standard/user/edit.tpl to include the following:
<div style="font-weight:bold;">My Posts</div>
{default current_user_id=$userAccount.contentobject_id
my-limit=25
mine=fetch(content,tree,hash(parent_node_id,2, attribute_filter, array(and,array('owner','=',$current_user_id ) ) ) )
my-count=$mine|count()
}
<b>Total:</b> {$my-count}
{section show=$my-count|gt(0)}
<ul>
{section var=it loop=$mine}
<li><a href={$it.url_alias|ezroot}>{$it.name}</a></li>
{/section}
<ul>
{/section}
The trick is how many objects do you want to show. I have over a hundred on my installation so I put a lmit in in the code like so ...
<div style="font-weight:bold;">My Posts</div>
{default current_user_id=$userAccount.contentobject_id
my-limit=25
mine=fetch(content,tree,hash(parent_node_id,2, limit,$my-limit, attribute_filter, array(and,array('owner','=',$current_u\
ser_id ) ) ) )
mine-total=fetch(content,tree,hash(parent_node_id,2, attribute_filter, array(and,array('owner','=',$current_user_id ) ) \
) )
my-count=$mine-total|count()
}
<b>Total:</b> {$my-count}
{section show=$my-count|gt(0)}
<ul>
{section var=it loop=$mine}
<li><a href={$it.url_alias|ezroot}>{$it.name}</a></li>
{/section}
<ul>
{/section}
There are still lots more ways to better use this functionality. This is just a simple example that worked for me. Might want to brush up on the documentation at the same time, tho :)
References:
http://ez.no/community/forum/setup_design/letting_users_edit_their_profile
http://ez.no/community/contribs/hacks/more_attribute_filter_operators_and_fetch_by_owner_id http://ez.no/ez_publish/documentation/reference/data_fetching/content/tree
Cheers, //kracker 311 : Seems Uncertain (String Quartet Mix)
Member since: 2001.07.13 || http://ezpedia.se7enx.com/
|