remember path to current record

A place for users and developers of the Xataface to discuss and receive support.

remember path to current record

Postby kurisusan » Sun Nov 18, 2007 11:25 am

Hi,
is there a way to remember the 'path' to the current record through the tables' relationships? Imagine a geographic database which is structured into countries, cities, wards, streets, etc. When looking at the record of a street, I would like to be able to navigate back to the higher levels.
Regards, Christian
kurisusan
 
Posts: 25
Joined: Sat Oct 27, 2007 2:40 am

Postby shannah » Tue Nov 20, 2007 1:27 pm

Hi Christian,

You can implement a getBreadCrumbs() method in the delegate class which returns the *path* to the current record. It must return an associative array representing the breadcrumbs.

e.g.

Code: Select all
function getBreadCrumbs(&$record){
    return array(
        'Home' => DATAFACE_SITE_HREF,
        $record->val('countryName') => $record->val('countryRecord')->getURL(),
        $record->val('provinceName') => $record->val('provinceRecord')->getURL(),
        $record->val('cityName') => $record->val('cityRecord')->getURL(),
        $record->getTitle() => $record->getURL()
    );
}


Notes about this snippet.

1. I am using object chaining (PHP5 only)
2. The keys of the array represent the labels for the breadcrumbs.
3. The values of the array represent the link urls for those labels.
4. I am making reference to calculated fields that you would need to define (e.g. cityName, provinceName, countryName), but this is just an example of what can be done.

Hope this makes sense.[/list]
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby kurisusan » Wed Nov 21, 2007 2:48 am

Thanks Steve, sounds good!

Once more I need to say that dataface is awesome. It is one of those software packages where whenever one of those 'it would be nice to have ...' thoughts comes into your mind, there is already a solution.

Regards, Christian
kurisusan
 
Posts: 25
Joined: Sat Oct 27, 2007 2:40 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 37 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved