building a url using database data

Lee

Well-known member
What I am looking to do is expand upon this thread;
http://xenforo.com/community/threads/controllers-and-model-help.52514/
where I created a model and controller to allow me to grab the last 5 articles and navigation menu.

I added a route called home to the database, but now what I want to do is expand upon that route so clicking each category in the menu takes you to a list of articles dedicated to that category with the route of home/catergoryname.id and similarly, clicking a article title takes you to a route of home/category.id/articlename.id

How would I go about writing the code to select the data based upon the url?

Cheers,
Lee
 
I would be happy with how xF handles it with its resource manager, i.e. categories and articles within them.

We could have a structure like;

home/categories/categoryname.id
and
home/articles/articlename.id

if that makes it any easier to accomplish what I want?

I just need help setting up the model and controller to do what I want and construct the URL - I can have a go at doing everything else myself.
 
Bumping your thread within a day is slightly unnecessary. However, you define a route, which you have as "home". When you access that route, any data is sent to actionIndex. If you define more actions, such as actionArticles and actionCategories, you'll be receiving data in those controller actions.
 
Bumping your thread within a day is slightly unnecessary. However, you define a route, which you have as "home". When you access that route, any data is sent to actionIndex. If you define more actions, such as actionArticles and actionCategories, you'll be receiving data in those controller actions.

Just eager to learn ;)

Thanks for the reply. I understand that part, what I don't understand is how to take the data from the url to select the right information from the database. Or the correct way to build the url and show the relevant data per url...
 
Back
Top Bottom