Re: [Dave] Divide a single list into multiple groups

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 16, 2009   (RSS)

By kovali - April 12, 2009

Hi Dave,

I have a similar problem and don't seem to find the right answer in this forum yet... This is the situation:

I have 2 sections (in the CMS for a real estate website were different Projects are presented each containing different types or amounts of buildings): "Projects" and "Buildings". In the first section "Projects" I can enter a title, description and 1 picture for every new project, then in the 2nd section "Buildings" I can select the projectnames from a dropdown menu, so a building can be divided into one of the previously created projects, and enter other detailed info about the building . This works perfect in the cms, but i have a problem with how to connect the results in the front-end of the website...

The front-end of the website should have following pages:

1. Listing of all Projects (Title - small description - picture - [>Details])
2. Next, clicking on one of the above projects [>Details] link should open a simple overview of all the buildings for that Project, like:
Project Name
Building Name 1 - Price - Rooms - [>Details]
Building Name 2 - Price - Rooms - [>Details]
Building Name 3 - Price - Rooms - [>Details]
...
3. Next, clicking on one of the [>Details] links here should open the complete details page for that building.

As i said before, i don't know how to setup the url's that will connect and open the data from "Projects" to the data of "Buildings", if possible.

Could you get me on the right track with this please ?

Thanks for your help,
Koen

By kovali - April 16, 2009

Hi Dave, many thanks for your help, it's working well the way you showed me!

From the projectList.php, I get the corresponding buildings in buildingsList.php with this code: [font "Verdana"]buildingList.php?project=<?php echo urlencode($record['title']) ?>

[font "Verdana"]One more question pls: Is it possible to show a field from the Projects table in the buildingList.php page? In the Projects table I have 2 fields (title & description), the title field is populated into the Buildings table but the description field isn't. However, I would like to show the full (project)description in the buildingList.php, like this:

[font "Verdana"]PROJECT ABC Corp (From Buildings table: "Title" is populated in Buildings table from Projects table)
[font "Verdana"]Full Project Description Here (From Projects table)
[font "Verdana"]Building 1 - ... (From Buildings table)
Building 2 - ... (From Buildings table)
Building 3 - ... (From Buildings table)


[font "Verdana"]Koen

By kovali - April 16, 2009

In addition to my previous message, I've been browsing this forum for a solution and came up with this code in the LIST page:

<?php

require_once "/home/vdwproje/public_html/beheer/lib/viewer_functions.php";

list($pandenRecords, $pandenMetaData) = getRecords(array(
'tableName' => 'panden',
));

list($projectenRecords, $projectenMetaData) = getRecords(array(
'tableName' => 'projecten',
'where' => " title = '" .mysql_real_escape_string($pandenRecord['project']). "' ",

));

?>

This way, I want to match the field "title" of the projecten table with the title in the url (example: http://www.vdwprojects.be/new/panden.php?project=Nieuwbouwproject+Wijgmaal+-+Kroonstraat )

But I get this error: Notice: Undefined variable: pandenRecord in /home/vdwproje/public_html/new/panden.php on line 11

I'm getting lost here, because I don't see the problem actually...

Koen