4
Contributors
6
Replies
9
Views
5 Years
Discussion Span
Last Post by calebcook
0

You have just answered your own question. The link you have provided appears to use JavaScript to do exactly what you ask. Why not view the source and extract the code?

Otherwise, find the ingredient measurements for a single serving and multiply this value by however many people the recipe should serve. It's simple multiplication.

0

Because it looks like the site also uses PHP for the conversion. I downloaded the code, but it looks like PHP creates a different script for each recipe. As for the simple multiplication, I need to be able to convert recipe units as well (cups, tablespoons, etc) Do you know of a way to convert it?
Thanks

1

interview the one who makes this kind of food.:) then you can formulate your own formula. it is like a simple math then. :) use if statements or loops or if there is a patter then use and equation.

if there is no equation. if input == 1 then 1tblespoon; else if input == 2 then 3tblespoon. piece of cake right?

Votes + Comments
nice pun :)
1

If you spent even a fraction of a minute looking at their HTML you'd notice an ajax link like this:
http://tastykitchen.com/recipes/wp-content/plugins/wp-recipes/ajax.php

If you use Firefox, Chrome or Safari, and opened the developer tools/firebug, and adjusted the servings you'd see that the site is using that to make an ajax request. Which then returns a full block of html that is replaced on the site.

Although that is not useful, what you will notice is the /plugins/wp-recipe/ part of that url.
Simply googled for "wp-recipe plugin" and got http://wordpress.org/extend/plugins/wp-recipes/

SImply download the plugin and review the actual PHP source code and you should have a great place to start from.

0

I actually created my own calculator script. Thanks for all the suggestions!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.