Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LImit results on a home page

Status
Not open for further replies.

case1001

Technical User
Feb 3, 2015
4
GB
Hi,
I am a basic user of HTML and CSS and i have made myself a website about movie reviews. When i open the home page all the movies that are in the database are being shown on the home page. My question is how can i limit the number of movies on the home page?
 
Make the database queries return less results would be one way.

But given this is the HTML & CSS section, you could set the ones you don't want to see to display: none;


So; ... if you want a better answer YOU need to provide far more information BUT I am going to go out on a limb and suggest that;

You open your WordPress dashboard, go to Settings -> Reading and change the number of posts per page.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thanks for that, but i am mainly looking to just see like the most recent 4 updates. So for example i upload lets say 5 movies and i just want to see on the home page the last 4 i uploaded. I know the way you suggested but that is a bit different. If you want more information just tell me what you need and i will provide it.
 
If you want more information just tell me what you need and i will provide it.

Server side scripting source, generated HTML source, or URL would be a start.
 
So this is the URL and it is taking quit some time to open because it has to generate all these movies and the graphs for their reviews and i was wondering is it possible to just make it so i only see the 4 most recently added to the database movies or maybe the most searched ones but i want to limit the results to at most 4 on the welcome page. If you can help me i would greatly appreciate it. Thank you.
 
This page does not look complicated so the trouble is in the back end. Does your SQL have "LIMIT 10" in it?

You may want to head to the section of Tek-Tips that relates to your backend scripting language and database.
 
The SERVER side code is what we need OR

You go ask in whatever forum category your website server just happens to run on. this section is for HTML and that cannot get information from a database.

If it is a content management system (Wordpress, Joomla, Drupal, etc.) with a 'theme' ask whomever designed the theme how it is done.

For us, looking at the HTML that appears in a browser tells us very little (meaning nothing) about the back-end system that powers your site and how it can be modified.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Basically i am using github and what i am asking is just how the algorithm would look. That is my problem. I will give you a scenario - i upload 5 movies and i want to see on the front page the last 4 movies that i have uploaded and every time i upload a new movie i want that movie to take the place of the movie that i have uploaded first (basically i upload movies 1 2 3 4 5 and after i upload them i just want to see movies 2 3 4 5 on the homepage and when i upload movie 6 i want to see movies 3 4 5 6). How does that look like in CSS/HTML. That is my question. It doesn't have to be exactly right i just need to see it so i can understand it and think of my own solution.
 
There is no algorithm presented in your HTML. This is an HTML forum.

If your algorithm is managed in JS, go to the JS forum here.

If your algorithm is managed in PHP, go to the PHP forum here.

...

Your generic mention of github makes me wonder if you know what is driving the data in your app. Can you point us to the github project you are using?
 
As spamjim suggested, the "algorithm" could be as simple as limiting the amount of results returned from the database query. i.e "LIMIT 4"

However, simply limiting the results will not give you pagination and the ability to view more than the first 4 results.

Without the back-end code to your site, we simply cannot suggest anything at all.







----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top