Related Records Portlets

Archived from the Xataface Users forum.

rolandsnowe — Tue Jan 22, 2008 4:16 pm

Hello again,

I have two questions regarding the related records portlets. The ones that show up on the left of the main record and have the ‘see all’ links in the h3 tags.

  1. How would I go about forcing the related portlet to appear even if there are no associated records? Say, for example, with the h3 title and some text that says ‘no related records’.

  2. Is it possible to force all of the related records to appear in each portlet, not sure if this is the default behavior, but I assumed not since there exists the ‘see all’ links.

Thanks for the help.


shannah — Sun Jan 27, 2008 7:36 pm

How would I go about forcing the related portlet to appear even if there are no associated records?

Currently there is no setting to allow this. The best way is probably to create a new section to show exactly what you want.

e.g. suppose we want a publications section for an author record. Then in the author delegate class we might have:

Code: Select all
`function section__publications(&$record){
    $pubs = df_get_records(‘publications’, array(‘author_id’=>$record->val(‘author_id’)));
    return array(
        ‘label’ => ‘Publications’,
        ‘records’ => $pubs,
        ‘class’ => ‘left’
     );

}`

Then you would hide the section for the publications relationship section by adding

Code: Select all
section:visible=0

to its definition in the relationships.ini file.

-Steve