Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following snippet works with the modified D7 API:
<!-- start snippet -->
<p>Who would you like to contact?</p>
<?php
$result = db_query('SELECT * FROM {contact} ORDER BY weight, category');
print '<div id="contact-list">';
print '<div class="item-list"><ul>';
foreach ($result as $contact) {
$cleanurl = str_replace(' ', '_' ,$contact->category);
print '<li>'. l($contact->category , 'contact/'. $cleanurl) .'</li>';
}
print '</div>';
print '</div>';
?>
<!-- end snippet -->
Comments
Comment #1
behindthepage CreditAttribution: behindthepage commentedThanks
Comment #2
Shadlington CreditAttribution: Shadlington commentedSo where would I put this to get it to work?
Comment #3
behindthepage CreditAttribution: behindthepage commentedHi Shadlington,
This snippet can be put in a page and customised to generate links to the unique contact forms.
I would use "-" as the space replacement or have no space replacement
You can also add the page info to the above snippet with this:
<?php print $contact->page_info ?>
Regards
Geoff
Comment #4
behindthepage CreditAttribution: behindthepage commented