Forum Moderators: coopster

Message Too Old, No Replies

Creating Master-Detail Page

Have dreamweaver but need it customized

         

kieftrav

3:13 am on Sep 20, 2006 (gmt 0)

10+ Year Member



Hello there. I have an array that holds all of the information I want displayed. Dreamweaver, on the other hand, uses a MySQL statement stored in a variable... As such, I'm wondering if any of you out there know how to create a master-detail page that has a first page, previous page, next page, and last page link that allows me to display 10 records at one time. Also, when I go to the detail page, I especially need to know how to get the specific row's information transferred. If anyone has any ideas, that would be great. Dreamweaver's code is a mess and I am looking for at least any kind of RESOURCE that can help... Google didn't help too much because it only referenced Dreamweaver...

Any ideas?

Travis

ahmedtheking

7:51 am on Sep 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First thing's first: hand code it in Dreamweaver! I've been using DW for PHP coding for a while now and everytime, I kep moving to such editors as TextWrangler!

Anyhoo, let's get on it:

So you have your page and you want to list the details:

<?php

// split ur array
$array = array_chunk($arrayfromsomewhere,"10",true);

// add links; we're assuming 'show' var is passed in the url to determine what page is shown
if (!$_GET['show']) {
echo "<a href=\"file.php?show=1\">next page</a>";
} else {
// let's show the data
foreach ($array[$_GET['show'] as $v) {
echo $v."<br />";
}

// finish up with the links
// check the arrays: if a chunk less than get:show exists, then they can go back. same for if a chunk greater than get:show exists, they can go forward
if (!empty($array[$_GET['show'] + 1)) {
// show next link
echo "<a href=\"file.php?show=".($_GET['show'] + 1)."\">next</a>";
}

if (!empty($array[$_GET['show'] - 1)) {
// show previous link
echo "<a href=\"file.php?show=".($_GET['show'] - 1)."\">previous</a>";
}
}

// finished
?>

Hope it works!

kieftrav

12:38 am on Sep 21, 2006 (gmt 0)

10+ Year Member



Thanks, Ahmedtheking, it worked!

ahmedtheking

8:21 am on Sep 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's all good. What you then can do, using PHP, is create a sort of OOP system that reads a template file and then replaces certain fields with data from the php