2

I have a weekly recipe list view, I manually create the list at the first day of the week.

for instance I assign Node 1 for Reference field labeled with Monday, Node 2 for Tuesday and so on using reference field in my Weekly content-type.

Next I made a page views of Weekly nodes and show the last node which contains that 7 referenced nodes previously mentioned.

What I want to do is to somehow determine today's date and change display mode of today's node along with Views Sort, like that if today is Sunday, the node referenced in Sunday field becomes highlighted and shows on top of the list.

Is there anyway to manage this using views, display suite or any other way?

2
+100

From what I understand your page view only displays a single (the last one) weekly node that in turn displays the fields with references. If this assumption is correct, what you can do (and what I would do in this case) is to create a node--weekly.tpl.php file in your theme folder based on node.tpl.php. Here you will be able to get the current day of the week in PHP. Based on that, use render() to display the reference fields in the order you wish, while adding the required html and css classes to make the current day highlighted.

More information about theming individual content types can be found here: https://www.drupal.org/node/17565

I don't know what's your experience with theming, but if you need help with the actual template, let me know.

[later edit] You can of course use a separate display suite template if you don't wish to override the general template of the weekly node. It's the same principle, but instead of having a node--weekly.tpl.php, you will have something like this: https://www.drupal.org/node/1098068 I think that the custom display suite layout involves a bit more work, but I may be wrong. Depending on your particular use case and how do you plan to display the "weekly" nodes across your website (e.g. if you will always have the same template or use multiple ways of displaying it), then you can choose one approach over the other. Both of them can help you accomplish what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.