Say I have a view that lists all the nodes on my site. Say I have three content types: page, news, blog.
If I sort by content type, I can only sort by ascending or descending order: e.g. "blog, news, page" or "page, news, blog".
What do I need to do if I want the articles to be sorted in an order of my choosing, say "news, blog, page"?
(I guess I could create separate views for each content type and attach them, but what if I had thirty content types, say, and added more regularly)
You could do sorting in the .tpl.php, if need be. Also, you could call the view programmatically, creating an array of sort terms, then filter by the node type, stepping through a loop of each term.
Views is quite robust in capabilities, but specific search order isn't as kind. I suppose you could try something a bit more funky, building a content type that just has a weight and another content type, then use relationships to display the view. Or maybe add a weight field to each existing content type, setting a default to each one, then sorting by weight, like 1 for news, 2 for blog, 3 for page. Taxonomy could also do some fun stuff with sorting.
Hope that gives you some ideas.
Joel
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of DTH Sent: Monday, March 12, 2012 3:43 PM To: support@drupal.org Subject: [support] Views: sort by arbitrary field value
Say I have a view that lists all the nodes on my site. Say I have three content types: page, news, blog.
If I sort by content type, I can only sort by ascending or descending order: e.g. "blog, news, page" or "page, news, blog".
What do I need to do if I want the articles to be sorted in an order of my choosing, say "news, blog, page"?
(I guess I could create separate views for each content type and attach them, but what if I had thirty content types, say, and added more regularly) -- [ Drupal support list | http://lists.drupal.org/ ]
Or simpler add 1 file as integer and use that as the sort value number like 10,20,30 or depending 100,200,300 then you can stick in between later.
--jerry
On Tue, Mar 13, 2012 at 8:52 AM, Joel Willers joel.willers@sigler.comwrote:
You could do sorting in the .tpl.php, if need be. Also, you could call the view programmatically, creating an array of sort terms, then filter by the node type, stepping through a loop of each term.
Views is quite robust in capabilities, but specific search order isn't as kind. I suppose you could try something a bit more funky, building a content type that just has a weight and another content type, then use relationships to display the view. Or maybe add a weight field to each existing content type, setting a default to each one, then sorting by weight, like 1 for news, 2 for blog, 3 for page. Taxonomy could also do some fun stuff with sorting.
Hope that gives you some ideas.
Joel
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of DTH Sent: Monday, March 12, 2012 3:43 PM To: support@drupal.org Subject: [support] Views: sort by arbitrary field value
Say I have a view that lists all the nodes on my site. Say I have three content types: page, news, blog.
If I sort by content type, I can only sort by ascending or descending order: e.g. "blog, news, page" or "page, news, blog".
What do I need to do if I want the articles to be sorted in an order of my choosing, say "news, blog, page"?
(I guess I could create separate views for each content type and attach them, but what if I had thirty content types, say, and added more regularly) -- [ Drupal support list | http://lists.drupal.org/ ] -- [ Drupal support list | http://lists.drupal.org/ ]
I think the module you are looking for is nodequeue. You can choose which content types to add to a nodequeue, and a view is automatically created. You can then reorder the nodequeue to your liking using an interface. I find this easier for the customer than adding a custom "weight-like" field.
Hope this helps, Ursula
On Tue, Mar 13, 2012 at 8:01 AM, Gerald Klein jk@zognet.com wrote:
Or simpler add 1 file as integer and use that as the sort value number like 10,20,30 or depending 100,200,300 then you can stick in between later.
--jerry
On Tue, Mar 13, 2012 at 8:52 AM, Joel Willers joel.willers@sigler.com wrote:
You could do sorting in the .tpl.php, if need be. Also, you could call the view programmatically, creating an array of sort terms, then filter by the node type, stepping through a loop of each term.
Views is quite robust in capabilities, but specific search order isn't as kind. I suppose you could try something a bit more funky, building a content type that just has a weight and another content type, then use relationships to display the view. Or maybe add a weight field to each existing content type, setting a default to each one, then sorting by weight, like 1 for news, 2 for blog, 3 for page. Taxonomy could also do some fun stuff with sorting.
Hope that gives you some ideas.
Joel
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of DTH Sent: Monday, March 12, 2012 3:43 PM To: support@drupal.org Subject: [support] Views: sort by arbitrary field value
Say I have a view that lists all the nodes on my site. Say I have three content types: page, news, blog.
If I sort by content type, I can only sort by ascending or descending order: e.g. "blog, news, page" or "page, news, blog".
What do I need to do if I want the articles to be sorted in an order of my choosing, say "news, blog, page"?
(I guess I could create separate views for each content type and attach them, but what if I had thirty content types, say, and added more regularly) -- [ Drupal support list | http://lists.drupal.org/ ] -- [ Drupal support list | http://lists.drupal.org/ ]
--
Gerald Klein DBA
www.geraldklein.com
jk@zognet.com
708-599-0352
Linux registered user #548580
The below contributed statements are well....funny and I apologize if someone is offended.....not.
Unix is user-friendly. It just isn't promiscuous about which users it's friendly with. - Steven King
Frustrated Windows users have two options.
Resort to throwing computers out of windows.
Resort to throwing Windows out of computers
Ever realized that if you play Windows CD backwards you'll hear satanic messages?
But that's nothing! If you play it forward it will install Windows.
"Ubuntu" -- an African word, meaning "Slackware is too hard for me".
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Linux is like a wigwam: no gates, no windows and Apache inside. (Chinese proverb c. 910 B.C.)
"being a Linux user is sort of like living in a house inhabited by a large family of carpenters and architects. Every morning when you wake up, the house is a little different. Maybe there is a new turret, or some walls have moved. Or perhaps someone has temporarily removed the floor under your bed" – Unknown
Customer: I'm running Windows... Helpdesk: Yes... Customer: ...and now my computer stopped working ! Helpdesk: Yes, you already said that.
The box said "Requires Windows 98 or better."
So I installed Linux.
I ran the Microsoft Malicious Software Removal tool
but Internet Explorer is still installed on my computer.
-- [ Drupal support list | http://lists.drupal.org/ ]