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

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

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

By Dave - April 15, 2009

Hi Koen,

Looks like this post got lost in the shuffle. I'm not sure if you've solved this or not but here's some tips.

Start with a list page that lists all the projects. Let's pretend that's called projectList.php (you can call it whatever you want). Link every project title to the building list page (see next item).

Next, create a list page that lists all the buildings (buildingList.php).

Finally, create a detail page that lists details about a certain building and is linked from the building list page.

Once you get all that working, review the search docs here: http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html and then update the link on projectList.php so it passes the project name as a search term. This will vary based on your field names but might look something like this:

buildingList.php?project=ABC Corp

And you can generate that with some code like this:

buildingList.php?project=<?php echo urlencode($record['project']) ?>

Hope that helps! Let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com

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