By shrill on
Hi everyone.
I want to put a "latest news" box on a site, but the "news stories" would link to existing items of various types on the site (e.g. calendar items, stories, bios etc.) rather than traditional "news" items. One possible way that would work theoretically would be to make a latest news menu and link the items to the menu: however, it would be helpful to be able to set things to expire in that case.
Is that possible? Any other ideas?
Thanks,
Shrill
Comments
Try creating a block type
Try creating a block type view whose search criteria are Published and DateAdded in the last n days.
Mine (this is for Drupal 5) looks like:
need a bit more control....
Hi. That is definitely a possibility: thank you. I'm hoping though to be able to pick and choose which items get put into the latest news box, rather than having all new items show up there (which is I believe what happens here?)
Thanks
Shrill
You are correct
Yes, the view I enclosed takes every blog, bookreview, recipe, and acidfree node from the last week and includes it in the box, limited to a maximum number of entries. To do what you want, you'd need some sort of flag you could set in each content node that would allow you to pull those items out from the database. Perhaps if there were something like "Promote to front page" on every node ... ;)
Seriously, there IS that flag built in to Drupal; you would need to get in the habit of setting it when you wanted items, and clearing it at a later point. Or you could try out the Scheduler module (http://drupal.org/project/scheduler) which might do what you're after. Or http://drupal.org/project/workflow_ng ?
Okay, so I think the block idea would work...
I'm looking at CCK and have created a "latest news" content type to pull from. It is an extra step but I want it to be easy for the non-techies who will be running the site.
How do you add a block like the one that you posted? Is it done in the php or is there any easier way?
Thanks again,
Shrill
Wrong approach?
I think CCK is the wrong approach here. You can use workflow-ng to do this (I checked with the developer) automatically, without adding CCK fields. Setting up a separate content type is just messy to me.
As for my code, it should import directly into the Views module (Admin->Views->Import View or some such).
But look at workflow-ng
looks pretty powerful...
My only concern is that it seems to be pretty "techie" if you catch my drift. It will be fairly "untechnical" people writing the content and I'm concerned that they might get confused.
Since you've used the module, do you think that can be avoided?
Thanks again,
Shrill
Actually
Actually, I haven't used workflow-ng, since my devel server is running D6, and workflow-ng isn't up to 6 yet. But if I understand correctly, you can set up the workflow to handle the changes automatically (i.e., without untechnical people's input). Your untechnical users wouldn't have anything to do with moving the content around, they'd just add content, and the site would manage the promotion/demotion. Presumably, a cron job would manage in the background.
But I speak based on surmise. Take a look at it and see whether it will help.
thanks so much for this...
I used a variant of your code with views to create the block. Looks fab.
Only remaining issue is that it only shows to my admin user when logged in. I've enabled other users through Views, through User Access....thoughts on where I could be going wrong? I want everyone to get this on every page (including anonymous users).
Thanks again,
Shrill
Hmmmmm
Well, Shrill, thanks to you I found out that my nifty Recent Items block wasn't showing to anonymous viewers (which is everyone except for me...). I have gotten it to work, but I am not certain which of the two steps I took made it visible.
The first step I took was to change the visibility of the Block by checking all the Roles in my setup. Go to Administer->Site Building->Blocks->YourBlock. The block configuration page expressly says that if you leave all the roles unchecked that the block will display for every role, but obviously, this wasn't true, so I purposefully selected all the roles. I logged out, and found that this didn't actually fix the problem, so next--
The second step I took was I changed the View visibility. I went to Administer->Site Building->Views->YourView->Edit. There I checked all the roles in the Access section. Again, the page expressly says that not checking any roles means that the view is not limited. When I logged out this time, the block displayed correctly.
I do not know whether the problem lies with Block or Views, so I can't really tell you whether you need only the Views change or both (clearly, setting the Block access didn't work alone...).
HTH,
David
hmmm...didn't work for me
Any other ideas?
Also, when you were theming the block, did you use the theme wizard or use existing divs etc? I have it almost right, but when I insert the graphic that I use as a bullet for the menus on the page to use as a bullet in my block, the links move to the next line.
Shrill
Theming the Block ... ?
uh.. well, I didn't theme the block. My site is using the basic Garland theme; I changed the color scheme and added my nifty logo, but beyond that, I haven't done much special (like theming blocks)...
Maybe if you started with a generic block and just tried to get that working, and only after that was working you tried theming and sticking special graphics in...
Duplicate
Duplicate posting