On Aug 18, 9:01 pm, "R. Rajesh Jeba Anbiah"
<[email protected]> wrote:
> On Aug 18, 8:39 pm, Martin Nilsson <[email protected]> wrote:
> > Your need for a "user top list" could be something like this
>
> > public class TopUsersComponent : ViewComponent
> > {
> > private readonly IUserService userService;
>
> > public TopUsersComponent(IUserService userService)
> > {
> > this.userService = userService;
> > }
>
> > [ViewComponentParam]
> > public string NumberOfUsers { get; set; }
>
> > public override void Initialize()
> > {
> > PropertyBag["viewmodel.Top10Users"] =
> > userService.GetTopUsers(NumberOfUsers);
> > base.Initialize();
> > }
>
> > }
>
> > In the view/layout (spark):
> > <TopUsers NumberOfUsers="10" />
>
> > or brail:
> > <% component TopUsersComponent, {...@numberofusers:'10'} %>
>
> > So your layout can look something like this:
>
> > <html>
> > <head>...
> > <body>
> > <TopUsers NumberOfUsers="10" />
> > <h1>bla bla</h1>
> > ....
> > <StockQuotes>
>
> Thanks; something is better than nothing. But, it's more work; for
> example, in CakePHP, it's $this->requestAction('/users/index/limit:10/
> sort:rating') from a view/layout. Thanks anyway.
Sorry to bang more... BTW, is there anyway to reuse controller
methods? For example, we have a user view page for showing user
profile and like to show user_comments inside that; here it looks like
that we have to create another component. TIA
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---