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

Mayur Pande
PLUS
Mayur Pande
Courses Plus Student 11,711 Points

How do I go about creating a web page, that has a set template for it?

For example what I want to be able to do is. I will have a portfolio with video items in it. If a user were to click one of the video items, I would want it to link to another page, that has a set template (so it would have the same layout if I clicked on any other video item) and then it could update the url accordingly and grab the data required.

So if I had a video with the name andrex the url would show;

www.somedomain.com/template/andrex

where /template/ is the name for the template I have designed.

I hope this makes sense.

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

A lot of frameworks make this really easy. For instance, the php framework Slim would be great for this, as it allows you to define routes, and set templates for those routes.

I'm actually not sure how I'd attack this from scratch, as there would be a fair amount of logic that would have to be considered. But you could also try to reverse engineer a framework that already provides this, and figure a lightweight solution of your own based on that.