I guess you could do a paginate with just a limit of 1 on the ingredients 
inside the recipes controller
I would have it as
recipes/view/recipe_id

So you'll do your paginate call and it should grab the first by default
And then just setup your next/previous links in your view using the 
paginator helper and it should take care of everything
Example clicking next should give you
recipes/view/recipe_id/page:2

And granted your paginate setup is correct it should do everything for you.


On Monday, March 19, 2012 1:43:17 PM UTC-7, pokerphp wrote:
>
> Let's just say i want to put a wikipedia style article about each 
> ingredient, or something. The point is I need to be able to navigate 
> ingredients in the recipe 1 by 1.
>
> I can only display 1 ingredient at a time. Clicking "Next" should bring 
> the user to the next ingredient in the recipe.
>
> Example.:
> prev <= THIS => next
> Olive oil <= BASIL => Some Nuts (for Pesto recipe)
> Tomato <= BASIL => Vinegar (for some sauce)
>
> I mean the prev/next links should point to different ingredients depending 
> on what recipe i am viewing the current ingredient for.
>
> So should it better be ingredients/view/ingredient_id/recipe_id
> Or recipes/viewingredient/recipe_id/ingredient_id
>
> Or are there any other better options I can't see?
>
> On Monday, March 19, 2012 10:11:47 PM UTC+2, cricket wrote:
>>
>> I think that paginating your ingredients is overkill. How many would
>> you ever have in a single recipe?
>>
>> If you're viewing a single Recipe, just list the associated
>> Ingredients in the same view. Just loop through associated Ingredient
>> array.
>>
>> On Mon, Mar 19, 2012 at 3:14 PM, pokerphp wrote:
>> > Hi,
>> >
>> > I have Recipe hasAndBelongsToMany Ingredient.
>> >
>> > I want to be able to browse ingredients of the recipe using next/prev
>> > navigation.
>> > Should it be done in RecipesController, or the IngredientsController?
>> >
>> > The way i see it is, if I use ingredients/view to display an 
>> ingredient, I
>> > have no way of knowing which Recipe I'm in (because same ingredient 
>> might be
>> > used in multiple recipes) unless i keep track of the recipe_id in some 
>> way.
>> > If i use recipes/viewIngredient instead, i now have to keep track of the
>> > ingredient_id... Doesn't seem nice either.
>> >
>> > Or am i doing/understanding something totally wrong here? I mean, maybe 
>> I
>> > should use IngredientsRecipesController, or something else yet?
>> >
>> > --
>> > Our newest site for the community: CakePHP Video Tutorials
>> > http://tv.cakephp.org
>> > Check out the new CakePHP Questions site http://ask.cakephp.org and 
>> help
>> > others with their CakePHP related questions.
>> >
>> >
>> > To unsubscribe from this group, send email to
>> > http://groups.google.com/group/cake-php
>>
>>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to