ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

orderby second name?

March 10, 2008 4:56pm

Subscribe [7]
  • #16 / Mar 10, 2008 6:16pm

    Jared Farrish

    575 posts

    You’re not using the weblog module to retrieve the entries, you’re using the query module, thus the orderby parameter isn’t needed. The query module will create the list in the right order. You don’t even need the {surname} variable, because that’s only needed for sorting within MySQL.

    Yeah, I was thinking it would have to go through a straight query, as the EE sql generator I doubt is setup to do AS aliases on an ad hoc basis.

    BTW, if someone were to have a last name of, say, “St. Germain” or “Le Monde”, it won’t sort correctly in those cases, as well as folks who sign up with different surname, givenname configurations, like many asian people who list their name in “last name first name” order (without a comma).

    FYI

    Thanks!
    Jared

  • #17 / Mar 10, 2008 6:22pm

    Mark Bowen

    12637 posts

    You’re not using the weblog module to retrieve the entries, you’re using the query module, thus the orderby parameter isn’t needed. The query module will create the list in the right order. You don’t even need the {surname} variable, because that’s only needed for sorting within MySQL.

    I was just asking though as Simon had said in his first post that he wanted to utilise a standard weblog entries tag and re-creating that kind of functionality with a sql query is never very easy.

    Is there no easy way of using this in a weblog orderby parameter as it would be great if it could be?

    Thanks.

    Best wishes,

    Mark

  • #18 / Mar 10, 2008 6:24pm

    Simon Clayson

    38 posts

    Looks fantastic thanks.

    I’ll look at this tomorrow. There are some other things to consider before I give this a spin. I’m still on EECore for this one at the moment (no query a gogo), and will probably be moving the site away from it’s current terrible host as I want to be running the eeFlickr plugin on this project. So there’s no point doing anymore donkey work yet…

    Simon

  • #19 / Mar 10, 2008 6:26pm

    Jared Farrish

    575 posts

    Is there no easy way of using this in a weblog orderby parameter as it would be great if it could be?

    What might be more interesting are standard variables for positions in a name, such as, {member_name_first_position}, {member_name_middle_position}, {member_name_last_position}.

    I think, though, the weblog should just provide the separated names bits as entered by a user (which means forcing a user to enter a first name, last name).

    Otherwise, it’s just guesswork…

  • #20 / Mar 10, 2008 6:34pm

    Mark Bowen

    12637 posts

    I totally agree with you on getting the person to enter them separately. Much easier and a whole lot more power at your fingers when it comes to outputting the data.

    Simon could you not tempt the client into having two fields upon the premise that you are going to be able to provide them with a lot more features down the line?

    Maybe give them a couple of examples as this might just entice them to do that method instead. Would be much easier than the query method as elegant as it is because then you would have the exceptional power of the weblog tag at your disposal which if you go with a query you won’t have and then along the line they are probably going to want something doing (clients always do!) which requires one of the weblog parameters or variables which you then wouldn’t have available to you.

    Just a thought though.

    Best wishes,

    Mark

  • #21 / Mar 10, 2008 6:37pm

    Jared Farrish

    575 posts

    If you HAVE to keep it one field, have them reversi: lastname, firstname. Sorts on last will work then (as well as first, if you think about it using the subquery method…).

    Of course, you might end up with a couple “Jr. Mark Clouds” if they forget and put in “Mark Clouds, Jr.”, instead of “Clouds, Jr., Mark”.

  • #22 / Mar 27, 2008 11:40am

    seajay

    109 posts

    This was mentioned earlier in the thread, but I haven’t been able to glean a solution.

    Separate custom fields for first, middle, and last names make sense. But I want the page title to be populated by a concatenation of first name, space, last name.

    Is there any way to automatically generate a title from custom fields?

  • #23 / Mar 27, 2008 11:57am

    Low

    407 posts

    Lots of variables here, seajay. What exactly are you trying to accomplish? Do you want to produce an alphabetically ordered list based on entry titles (which was the original question)? If so, then this could help.

    Or do you want to create custom <title>s for your pages with the help of several custom fields (which looks like you’re asking)? Then you might want to check out this blog entry.

  • #24 / Mar 27, 2008 1:50pm

    seajay

    109 posts

    Thank you, Lodewijk. The second direction is where I’m going.

    I have three custom fields:

    [staff-name-first]
    [staff-name-middle]
    [staff-name-last]

    I would like the page title to be:

    [staff-name-first] SPACE [staff-name-last]

    I’m going to try your title plug-in. I’m hoping there is some way I can combine the two fields for the title.

  • #25 / Mar 27, 2008 1:54pm

    Low

    407 posts

    I’m going to try your title plug-in. I’m hoping there is some way I can combine the two fields for the title.

    I see no reason why you couldn’t use regular weblog:entries tags to do just that…

  • #26 / Mar 27, 2008 1:58pm

    seajay

    109 posts

    I do understand that the Weblogs tag affects presentation through templates.

    I was envisioning being able to control the title as it appears on the CP Publish/Edit screens. (I did that in another CMS ...)

    It’s not a showstopper. I was just hoping to make it easier for authors ...

    And, above all, thanks to you (and everyone) for such helpful responses. I’ve been doing this for a while, and this community is the best ...

    (P.S. I’d also like to avoid double entry of names, once in the title and once in the custom fields.)

  • #27 / Apr 01, 2008 12:51pm

    Simon Clayson

    38 posts

    Low, I can confirm today that it works a treat. My only problem now is that I have a person with three names “FIRST SECOND ANOTHER” but I’m not sure where that one is to go yet

    Thanks again for everyone for all the input

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases