When I create top 10 articles on my website (top 10 board games just for example,) I typically make one page with 10-6, and a next button at the bottom with a link to another page that has 5-1. I've been wanting to make it so it has more of a slideshow function. Like this website... http://whatculture.com/film/10-obscure-superheroes-that-badly-need-a-movie-treatment.php When you click "Next >>" it doesn't go to a whole new page, but quickly changes content and the website extension changes to ....php/2 ....php/3 and so on. What is this called? I would like to learn how to do this if anyone has any advice for me.
It's called AJAX, and is strictly not a PHP-question, but a javascript one. Simply put, you have a link which doesn't link to another page, or for that matter, has to be a link at all, which triggers a javascript function which polls content from a separate PHP-file (this file does all the processing), and then puts it into the page you're on. Pseudo-code follows: //mainpage <div id="contentgoeshere"></div> <button name="nextpage" id="nextpage">Go to next page</button> //js-function (yes, this is based on jQuery) $("#nextpage").click(function() { $.post('process.php', {var1, var2, var3}, function(data) { $("#contentgoeshere").html(data); } }); }); Code (markup): And in the process.php-file you'd have whatever you'd need to pull the content you wanted out. The variables in the js-function (var1, var2, var3) can be anything you want - you can use specific hidden input-field values, or just hardcode some counter into the js-function. All this is maybe a little abstract, but if you look up for instance "loading webpages via ajax" on google, you'll probably find a lot to read.[/code]
Most excellent. Been wondering how to implement this for a while, now that I'm a bit less noobish in .js and php, I'm ready to bite into this. Thanks a ton.
I would advice you to use dynamic scripting you should store the data in the table and change it as per your need using text editors facilities in the admin panel , this is the best way to solve your dynamic content problem.
I agree with digiface. The Ajax will be awesome for grabbing the new content from a folder or database..but to have those vars there I would connect it to a PHP dynamic page with a script that calls the data to be displayed (that way you're not making a new HTML page every time , instead you upload new data to be displayed to a folder /text file or database. The script should use AJAX engine to then trigger new event to load new data on each page (which will stop page refresh/reload.) The thing to consider though is that your pages won't index well with dynamic data. so if you're trying to SERP rank your Top 10 list.. its probably better to write it as separate articles and make it static. Top 10 lists are cliche' method for traffic and those pages can score high and you can of course use those pages to set links for others (of course by Google LAW you wouldn't CHARGE people money for those though..my god that would be horrible)
I was just using a top 10 list as an example. I was finding it hard to explain what I was trying to do without knowing what it is called. Thanks to all of you for your input. I really appreciate it.