alphabetical order

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 28, 2008   (RSS)

By grauchut - March 27, 2008

Dave,

Is there a way I can have my clients update these pages. http://www.lawntonfire.com/members.php. I will need them to go in alphabetical order. Some members have profiles which I can set up cms for them to update. I just wanted to know if there is a way to make them post alphabetical order. Thanks Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] alphabetical order

By Dave - March 27, 2008

Absolutely. You can set them to sort in alphabetical order with the orderBy option in the list viewer like this:

$options['orderBy'] = 'name';

What I would do is create a section for "members" and have fields for "group" (which would be a pulldown Line Officers, etc), name, and so on. The make that page a list viewer and sort by name then group like this:

$options['orderBy'] = 'name, group';

Then here's the trick. Call the "foreach listrows" code multiple times, having each time just show one group. Like this:

<h1>Line Officers</h1>
<?php foreach ($listRows as $record): ?>
<?php if ($record['group'] != "Line Officers") { continue; } ?>
Name: <?php echo $record['name'] ?><br/>
Title: <?php echo $record['title'] ?><br/>
<br/><br/>
<?php endforeach ?>

<h1>Executive Officers</h1>
<?php foreach ($listRows as $record): ?>
<?php if ($record['group'] != "Executive Officers") { continue; } ?>
Name: <?php echo $record['name'] ?><br/>
Title: <?php echo $record['title'] ?><br/>
<br/><br/>
<?php endforeach ?>


That will also let you format each group differently if you want.

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

interactivetools.com

Re: [Dave] alphabetical order

By grauchut - March 27, 2008

Dave,

I am a little confused with this. "What I would do is create a section for "members" and have fields for "group" (which would be a pulldown Line Officers, etc), name, and so on". Do I need to create different menu for each: Members, Officers, Etc. Also everyone has an email account that is posted with their profile. Is it possible to get this set up when you click on the name it opens like any other link for an email address? Thanks Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] alphabetical order

By grauchut - March 27, 2008

Dave,

Also the link I included in the first post. Is there a way to make it the same way. Where the names and titles are laid out and you can click on their name to see their profile. Thanks Again Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] alphabetical order

By Dave - March 28, 2008

Yes, it would be one section, and you can have the emails open up when you click on them. Just take it one step at a time.

Start by creating a new section editor with fields for: group, name, title, and email

Then enter a few test records.

Then get your basic list page working (just copy and paste the code).

Then try and get them to display in groups like I showed in my post above.

Once you get that far let me know (or let me know if you need help) and then we can work on the columns and linking up the emails.

Hope that helps!
Dave Edis - Senior Developer

interactivetools.com