PDA

View Full Version : having all products and pictures show when clicked


swissbeets
06-21-2008, 11:57 PM
i am relatively new to php and was wondering: i have all my my products divided into separate categories, once a category is click i want all of the items in the category and their related information to be shown in the body until they are clicked which will then take show them a larger pictures and a full description. i cannot find a way to do this with php and was hoping for any kind of guidance or help.

thank you very much

davidj
06-22-2008, 07:15 AM
post ya code

swissbeets
06-22-2008, 11:24 PM
this is the function that i use inthe public site to allow navigation




function public_navigation($sel_subject, $sel_page, $public = true)
{
$output = "<ul class=\"subjects\">";
$subject_set = get_all_subjects($public);
while ($subject = mysql_fetch_array($subject_set)) {
$output .= "<li";
if ($subject["id"] == $sel_subject['id']) { $output .= " class=\"selected\""; }
$output .= "><a href=\"index.php?subj=" . urlencode($subject["id"]) .
"\">{$subject["menu_name"]}</a></li>";
if ($subject["id"] == $sel_subject['id'])
{
$page_set = get_pages_for_subject($subject["id"], $public);
$output .= "<ul class=\"pages\">";
while ($page = mysql_fetch_array($page_set))
{
$output .= "<li";
if ($page["id"] == $sel_page['id']) { $output .= " class=\"selected\""; }
$output .= "><a href=\"index.php?page=" . urlencode($page["id"]) .
"\">{$page["menu_name"]}</a></li>";
}
$output .= "</ul>";
}
}
$output .= "</ul>";
return $output;
}
?>
function get_pages_for_subject($subject_id, $public = true)
{// this is displaying the pages in a list form for the navigation bar, but i want this to be displaying in the body and showing small pictures
global $connection;
$query = "SELECT *
FROM pages ";
$query .= "WHERE subject_id = {$subject_id} ";
if ($public) {
$query .= "AND visible = 1 ";
}
$query .= "ORDER BY position ASC";
$page_set = mysql_query($query, $connection);
confirm_query($page_set);
return $page_set;
}

// i have not yet input the pictures and am basically still working through many small problems but this is just one step. if nothing else i would like them listing side by side and listing all of the pages of the subject in the body until one is clicked. right now it is just showing the first page rather than all of them when clicked.


thanks again

davidj
06-23-2008, 06:11 AM
as you can see from the syntax (where the colour changes) you have a rogue php end tag in there

here...


$output .= "</ul>";
return $output;
}
?> /// <<<


you are using an advanced method which is beyond you at the moment. I think you have tried to copy the code, parrot fashion without actually understanding what your doing.

I suggest you follow my video tutorials first. This will give you a grounding and an understanding of the language your working with.

check my signature for a link to the tutorials

swissbeets
06-23-2008, 11:11 PM
yes i used the lynda.com tutorial and just now finished it, to make sure my code had no mistakes i simply used to the exercise files of the disk. i know most of the code since i did go over it while it was being done. it is displaying the $output which is being appended as the $page is equal the the array correct? i will look at your tutorials thank you very much for your help