I'm moreless curious about webpages that are indexed. An example is gamestop. When you are looking through their product lists they have indexed for multiple tabs like 123456 on the near the bottom of the page. I also notice this with many search engines and pages selling products. I know it sounds dumb to ask a question like this, but I've always been curious how to code a mutiple indexed page like the example listed above. I hope you fellow coders out there could provide some sample code to demonstrate this idea would be perfect. Plus, it could help me in future to see just how it is done. Please provide any info you can. Thank you :)
Actually the INDEXING you are referring is called Pagination. Whenever you have multiple items/Records and you want to show only some of them in one page and rest on the other. e.g. you have 100 records in the database and you want to show all of them but loading all at once will slow down your page. So what programmers do is, they use pagination.
What they do is , They will show first 10 records on one page. if you have 100 records in database. Then first page will show records from 1 to 10, 2nd page will show 11 to 20 and so on till the end.
use reference
http://code.tutsplus.com/tutorials/how-to-paginate-data-with-php--net-2928
or
Simple PHP Pagination script
Related
I need to find a way to know how many pages an external link might have depending on the products i choose to see per page.
eg:
This link might have 36 products and I'm asking to see 5 products per page:
https://externalsite.com/cat/dvd-cat/sub-cat/?per_page=5
When I click on page two, I get the link this way:
https://externalsite.com/cat/dvd-cat/sub-cat/page/2/?per_page=5
What I need to find is how many pages the first URL will have in PHP
My friend started a blogging website using wordpress for students to write on topics like world affairs, british politics etc. He is a philosophy student so himself doesn't any coding or web development and hence asked me since I'm doing a computer science degree to help him modify the search on his website. Basically the issue is that the search works normally except when you want to use it to search by articles written by a specific author. For example if you write the name of a person, all the articles written by him/her should be displayed. I have no experience in web development but watched loads of videos on youtube on how to customise the search but most of them just show to change its position on the page or just how it looks and none the way I want to specifically customise it. Are there links to any videos on youtube or articles that explain how to do it or what should I do to customise the search in this way?
I have been telling him for the past week that I will help in because I was confident I would have solved the problem but since I actually started trying the past couple days, I've seen so many ways it could go wrong from ftp to messing up the whole website. I'm sure if it's not clear enough or my question is stupid, I thought for a while before posting this on stack overflow.
MODIFY YOUR THEME’S SEARCH.PHP FILE
What we want to do is first take a look at the current search results page. If your theme is not presenting a search bar to make an actual search query, then you can simply append the following to your site’s URL : yoursite.com/?s=your+search+string.
Passing this query will send you to the search results page. Ideally your query should actually produce results so you could try to use a general search phrase that you know will produce multiple results.
Once you have a good idea as to how the results looks now, you can visualize a clear direction as far as how you want it to look. The search.php file usually starts with the following link :
this link
Today multiple questions came to me about how web servers work with a basic code of request in database and display to the front.
For the example of a blog where we want to display our posts
I don't know any other way than
Query the database then stock the result in a php variable
Foreach the variable in the front to display the different contents
as simple as that but the question is :
Does the database query each time a visitor browse the web page supposed to display our posts ?
For me it has always worked as this. But now I'm asking myself why do we make requests on a table that we (the writers of the posts) update like one time each week everytime we visit the page ? In the case of a blog with thousands daily visitors while we update it every week, Do we query the database that much time ?
The question is the same for the php process that "foreach" every posts which require a little bit more process for the server before displaying the web page. Multiplied by the number of visitor.
If it really works as I think, how do we avoid all of these ?
Its sounds like you want to use Caching - there are simple ways to do this, and libraries/products that can help you see this article and this library
I am working on e-commerce project. Book Section has 60,000 books and 37,000 authors in my mysql tables.
here is the link of book table structure
Book page takes 13 seconds to load-Horrible. I want to know that is there any tool that Give me real time analysis. It mean, I refresh page and I can see total number of queries executed when page load completes. So I can analyze and write time effective queries.
Additionally, Please guide me little for how can I improve mysql performance for such e-commerce project. Project's Index page displays 3-4 items from all section like camera, Apparels, Mobile etc. So in turn fetch from almost all categories.
Please help.
Thank you In advance.
Are you limiting your result set of the data returned? Please remember to post the query that you are running.
I want to write an app that parse particular threas on a phpbb forum. So if a thread has 200 pages with 10 posts (that doesn't give you the ability to adjust the post count per page), and has an address like this:
http://www.forum.com/viewtopic.php?t=10&postdays=0&postorder=asc&start=0
where start parameter changes when you navigate to the next pages of the same thread, how do you get the full thread in one go?
I tried:
http://www.forum.com/viewtopic.php?t=10&postdays=0&postorder=asc&start=0&end=2000
but didn't work.
Surely there must be a way to do this I imagine.
If you're parsing, just parse each page, then add up the results in the end. If the forum doesn't have an open API, or any way to display all of the posts on one page, this is what your are going to have to do. Perhaps you could write a recursive function that checks for a 'next page' link or something similar, follows it, then returns all of the data from the pages compiled.
EDIT: looking at example url you gave, have you tried changing the t variable? you said it was 10 posts per page, and that was set to 10, so maybe that's what controls posts per page.
http://www.forum.com/viewtopic.php?t=2000&postdays=0&postorder=asc&start=0
Some super handsome fellow wrote a MOD for this if it is your forum:
http://www.phpbb.com/community/viewtopic.php?f=69&t=1101295