Page 1 of 1
php to Navigate Through Records
Posted: Wed Jul 02, 2008 7:23 pm
by millsy007
I have some code (
http://devzone.zend.com/article/3336-Re ... s-with-PHP) that read the contents of an excel spreadsheet and then puts this into an array.
I have it so that it outputs the contents of the array onto the screen, what I would really like is for it to only show one record from the array at a time, and for the user to then click a 'next' to see the next record within the array, preferably without having to reload the whole page
Is there a way to do this, perhaps with a combination of css and php.
Re: php to Navigate Through Records
Posted: Wed Jul 02, 2008 8:11 pm
by califdon
millsy007 wrote:I have some code (
http://devzone.zend.com/article/3336-Re ... s-with-PHP) that read the contents of an excel spreadsheet and then puts this into an array.
I have it so that it outputs the contents of the array onto the screen, what I would really like is for it to only show one record from the array at a time, and for the user to then click a 'next' to see the next record within the array, preferably without having to reload the whole page
Is there a way to do this, perhaps with a combination of css and php.
You would probably want to do this with Javascript, because to do it with php you would need to use $_SESSION variables to achieve persistence from one call to the next. I guess that could be done, but if your array is very large, there might be a problem with server memory. Anyone know what limits there may be?
Re: php to Navigate Through Records
Posted: Thu Jul 03, 2008 6:21 am
by millsy007
It would probably be around 10-15 records (each containing a few lines of text) so memory shouldnt be an issue.
I think javascript is the way forward, I have found fairly similar things around image galleries, however I basically need to cycle through content.
Re: php to Navigate Through Records
Posted: Thu Jul 03, 2008 6:22 pm
by califdon
millsy007 wrote:It would probably be around 10-15 records (each containing a few lines of text) so memory shouldnt be an issue.
I think javascript is the way forward, I have found fairly similar things around image galleries, however I basically need to cycle through content.
That being the case, I will move this topic to Client Side.
Re: php to Navigate Through Records
Posted: Tue Jul 08, 2008 12:40 pm
by Ollie Saunders
Simple technique would be:
- Output the whole thing with the starting item identified by a class
Code: Select all
<ul id="munchkin">
<li>foo</li>
<li class="show">bar</li>
<li>zim</li>
</ul>
- Use CSS to hide everything except the show
- Add some JS that runs when some hyperlinks, elsewhere in the markup, are clicked. jQuery is good for that

Also note that what you are attempting to implement it called an "accordion" or "carousel" depending on how you make it look. So you could google for them to see some examples.