<ul>'; foreach ($law->references as $reference) { $sidebar .= '<li><span class="identifier">' . SECTION_SYMBOL . ' <a href="' . $reference->url . '" class="law">' . $reference->section_number . '</a></span> <span class="title">' . $reference->catch_line . '</li>'; } $sidebar .= '</ul> </section>'; } /* * If we have a list of related laws, list them. * Note that Solr < 4.6 will probably die horribly trying this. * We catch any exceptions as a result and go about our business. */ try { $search_client = new SearchIndex(array('config' => json_decode(SEARCH_CONFIG, TRUE))); $related_laws = $search_client->find_related($law, 3); if ($related_laws && count($related_laws->get_results()) > 0) { $sidebar .= ' <section class="related-group grid-box" id="related-links"> <h1>Related Laws</h1> <ul id="related">'; $related_law = new Law(); foreach ($related_laws->get_results() as $result) { $related_law->law_id = $result->law_id; $related_law->get_law(); $related_law->permalink = $related_law->get_url($result->law_id); $sidebar .= '<li>' . SECTION_SYMBOL . ' <a href="' . $related_law->permalink->url . '">' . $related_law->section_number . '</a> ' . $related_law->catch_line . '</li>'; } $sidebar .= ' </ul> </section>';