Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Enhancing a Simple PHP Application Paginating a List: Controller Calculating Shirts from Page Number

Giovanni Valdenegro
Giovanni Valdenegro
13,871 Points

The get_products_subset function was never defined in products.php??

New function never assigned:

On shirts.php we changed the function get_products_all();

to get_products_subset($start, $end);

This was never defined under the model on products.php. I dont get it how this function works if I never defined it???

Is this PHP prebuilt function or where is it coming from?

2 Answers

This current video isn't calling that function at all. If you examine the video at, say, around 4:24 or so, you'll notice the php word "exit" before the $products = get_products_subset($start, $end);

So php stops at the exit call and never proceeds forward to the function. The code that's running in the browser when Randy tests it, is all the code preceding the exit call.

Giovanni Valdenegro
Giovanni Valdenegro
13,871 Points

I noticed that after I wrote it. Quite an anticipated question. He actually talks about that function in the following video.

Thank you for your response much appreciated.

Giovanni