Posted by josejayesh on April 20, 2012 at 7:46am
Guys,
I am planning to create and contribute a drupal module that will set the home page on random basics (from available nodes and views ). I hope this will be useful for site that is display only video or audio content. Eg – www.videofog.com (it is my own site). Please give your feedback or suggestion. If you feel similar kind of module exists please report that as well
Thanks
~Jayesh
Comments
Hi Jayesh, For the above
Hi Jayesh,
For the above requirement,it can be done using the views itself.No need of custom module.
Can you explaing how we can do that
Saurabh,
Can you explain how we can do that with views .
As far as my understanding using views we can create query that will fetch various nodes/contents (some thing like a query builder) . But for setting a page as a home page we need to update the node/views in the Site configuration interface (in backed it will create an entry in the variable table site_frontpage).
I got some info from drupal.org
I got some info from drupal.org and understand that we can use nodes in random basis.
http://drupal.org/node/161292
1) But how we can set available views in random basics
2) Setting the random home page using views is bit tricky , what 1 am planning is if this module is installed if configured to check boxes in admin side
"
If checked nodes random module will be used for setting the home page
If checked views random module will be used for setting the home page
"
Will it make sense
Its a bit complicated when
Its a bit complicated when you say "random page" what you mean with Drupal. You wouldn't have a random page you'd have one view that showed random nodes... but that node may be a "basic page content type" which in effect would be showing a random page.
I think to make the random element of it work you'd use this:
http://drupal.org/project/views_random_seed
I only briefly looked over your link but that is for drupal 4 and 5. So I dunno if that would apply.
Unfortunately I cannot understand your last comment. If you're asking if you can have a check box that makes it appear on the front page. 1) that already exists and can be used by views for your random view and 2) you can use fields to make other kinds of check boxes.
You can use Views Bulk Operations to build an admin page to manage these checkboxes. Especially if you combine it with rules.
http://drupal.org/project/rad
http://drupal.org/project/radioactivity
This module will probably be really useful as well for a video site you're talking about.
@james
Hi James,
Thanks for the replay
What exactly I want to do is simple
1) If more than one node are present in the system and specified module is enabled and configured for node take the random node and set that one as home page without the over head of view module
.
2)If more than one views are present in the system and specified module is enabled and configured for views take the random view and set that one as a home page.
If you can check my site
www.videofog.com ,
in this site I have various video play list
http://videofog.com/?q=Video/English/Movie/PlayList/English-trailer
http://videofog.com/?q=video/learning/php/playlist/Zend
http://videofog.com/?q=Video/Hindi/Movie/PlayList/Hindi-trailer
etc.
Here I want set the home page random basics. It can be easily done if can update/insert drupal ‘variable’ table field ‘site FrontPage’ with the help of drupal hook_init() function
Thanks
~Jayesh
Never ever use variable_set
Never ever use variable_set during init on every request, it kills the caching of variables completely.
Just make sure you trailers are nodes and just use one view and the random field.
james/swentel Thanks for the sugestion
james/swentel Thanks for the sugestion