Jump to content

How to store a ingredients list


davydhaeyer
 Share

Recommended Posts

I want to create a website where we can store recipes but one important thing of a recipe is a list of ingredients. 

How should I store a list of ingredients as I don't know how much fields I need. 

Basically I need a input type that can dynamically add new text fields.

Is there a way to do this ?

Link to comment
Share on other sites

Hi davydhaeyer, welcome!

One solution is to create every ingredient as page too and link as many as you want to your recipes.

Your page tree would look something like this:

- recipes

-- recipe1

-- recipe2

...

- ingredients

-- ingredient1

-- ingredient2

...

In your recipe template, you can create a Page field (autocomplete) to add ingredients. This way you can add as many ingredients

as you want and create them on the fly, if they don't exist:

http://processwire.com/videos/selecting-and-adding-pages-with-autocomplete/

(suppose the tags in the video are your ingredients)

However, if you need additional data to an ingredient e.g. the number or weight, things get a bit more complex

-> Repeater :)

Cheers

  • Like 3
Link to comment
Share on other sites

So it is possible to create new "ingredients pages" from a new/edit recipe ? 

Edit -> Sorry missed that option, thank you!

Hi davydhaeyer, welcome!

One solution is to create every ingredient as page too and link as many as you want to your recipes.

Your page tree would look something like this:

- recipes

-- recipe1

-- recipe2

...

- ingredients

-- ingredient1

-- ingredient2

...

In your recipe template, you can create a Page field (autocomplete) to add ingredients. This way you can add as many ingredients

as you want and create them on the fly, if they don't exist:

http://processwire.com/videos/selecting-and-adding-pages-with-autocomplete/

(suppose the tags in the video are your ingredients)

However, if you need additional data to an ingredient e.g. the number or weight, things get a bit more complex

-> Repeater :)

Cheers

Link to comment
Share on other sites

If you look at the bottom of the link that Wanze pointed you to, you'll see the

"Allow new pages to be created from field" option.

So long as that is checked, then yes, you can create new ingredients on the fly from the field in your recipe page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...