Daily question in my drupal website - drupal

I am new to drupal so may be my question will be very dumb.
I want to show daily questions on my website which is build using drupal. The question is of multiple choice and the options should be displayed by default. The visitor will simply click on the ans and press submit to ans. It seems to be like a poll but i dont want to show the summary on submission instead i want to show the correct ans.
Thanks in advance :)

The Quiz module provides, well, quizzes and supports multi-choice questions. After a quiz has been fully answered, it provides various display option. It may suits your need if you use single-question quizzes.
For the quiz to be daily, you may have to add some code or use additional module to handle automatic creation, publication and de-publication of your daily quizzes.

I don't know of any module that will do this out of the box, but the built-in, core module "poll" will do something terribly close.
To get the exact functionality you desire, you could simply override the template files for poll to make it so that it does not display the results upon submission. Then you could make a comment on the poll that contains the correct answer. (You can do this without allowing others the ability to comment.) This would effectively meet the given requirements.
Anyway I know its not a perfect solution, but it would give you the described requirements without too much work.

Related

Implementing a "Like" button and showing users who clicked it

Our website is powered by Drupal 7 and we are looking for a way to implement a "I am Interested" button/link on a particular node for registered users. The problem here is that we'd also like to be able to display all the usernames who have clicked this button/link.
The idea here is to provide our viewers with a simple way to be able to indicate interest in a particular topic, and essentially giving them an outlet to communicate to other users who have shown the same interest.
I've tried a number of different modules that other sources have suggested: "Flags, Dlike, LikeBtn, Rate Widget, etc." and unfortunately they don't seem to ultimately do what I'm looking for. I want to believe that there is some combination of modules that can perform these actions, so I would greatly appreciate any guidance that can be provided.
I do apologize for my ignorance in this type of development. Looking forward to growing into this community.
Cheers.
You can achieve that with the Flag module (which you tried), and the Views module to display a list of users that have clicked the flag for a particular node.
Looks like this answer would help you out with the Views config to list users that have flagged a node (or poked a user in the example).

Drupal - form or content type and general how to do it?

(I know there is a module, but I'm trying to learn on my own)
I basically want some kind of form or page where I create a form for an administrator.
So, the administrator can fill in the question and can add more than one right answer. Sorta like a multiple choice question with more than one answer.
The user will go ahead and answer the question.
Do, I create a content type? Do I use form api instead. Not sure at this moment how to go about it.
Thanks.
The Quiz module provides tools for authoring and administering quizzes through Drupal. A quiz is given as a series of questions, with only one question appearing per page. Scores are then stored in the database.
From what I get, you can create a custom drupal module and use form api for creating Multipage forms and add pragmatically add validaters for adding you correct result before moving to the next page/form.
Writing a simple. Hope this helps and contact if you need help.

Drupal comments per fields

I have been looking all over for this, but so far without any luck. Is there a way to have comments per field instead of per node in drupal? If there are no modules available for this, do you think it would be hard to implement?
I thought I could make a "pseudo-content-type" with views that's nothing more than several content types displayed one on top of the other, so you could comment any of them. But then I don't know a way of making the user create all those content types at once.
The built-in comment module is not going to do comments per field on a node. I've been drupaling for almost three years and I don't know of any module that allows comments per field.
It is possible to do, but it would take a custom module and plenty of slick programming to get it to work. As far as difficulty I think an intermediate PHP developer with some knowledge of Drupal should be able to whip this out.
A kind of quick solution would be using panel module; form all your commentable content in nodes ad put them together all into a panel. This is kind a quick and static solution, possibly with views one can make it more custom.

How do you find the balance between Javascript (jQuery) and code behind in ASP.NET

Stackoverflow members,
How do you currently find the balance between javascript and code behind. I have recently come across some extremely bad (in my eyes) legacy code that lends itself to chaos (someHugeJavafile.js) which contains a lot of the logic used in many of the pages.
Let's say for example that you have a Form that you need to complete.
1. Personal Details
2. Address Information
3. Little bit more about yourself
You don't want to overload the person with all the fields at once, so you decide to split it up into steps.
Do you create separate pages for Personal Details, Address Information and a Little bit more about yourself.
Do you create controls for each and hide and show them on a postback or using some update panel?
Do you use jQuery and do some checking to ensure that the person has completed the required fields for the step and show the new "section" by using .show()?
How do you usually find the balance?
First of all, let's step back on this for a moment:
Is there a CMS behind the site that should be considered when creating this form? Many sites will use some system for managing content and this shouldn't be forgotten or ignored at first glance to my mind.
Is there a reason for having 3 separate parts to the form? I may set up a Wizard control to go through each step but this is presuming that the same outline would work and that the trade-offs in using this are OK. If not, controls would be the next logical size as I don't think a complete page is worth adopting here.
While Javscript validation is a good idea, there may be some browsers with JavaScript disabled that should be considered here. Should this be supported? Warned about the form needing Javascript to be supported?
Balance is in the eye of the beholder, and every project is different.
Consider outlining general themes for your project. For example: "We're going to do all form validation client-side." or "We're going to have a 0 refresh policy, meaning all forms will submit via AJAX." etc.
Having themes helps answers questions like the one you posted and keeps future developers looking in the right places for the right code.
When in doubt, try to see your code through the eyes of someone who has never seen it before (or as is often the case, yourself 2 to 3 years down the road), and ask yourself: "Based on the rest of the code, where would i look for this function?"
Personally, I like option number 3, but that's just because it fits best with the project I'm currently working on and I have no need to postback or create additional pages.

Drupal 6 module for adding CCK-like fields to comments?

I'm needing to allow users of a site to add structured comments to nodes. Are there any stable modules out there for Drupal 6 that will enable me to do this? I'm thinking along the lines of being able to add CCK-like fields to the comment type. In an ideal situation the administrator would be able to alter/change the questions being asked on a node-by-node basis, but not necessary. We're after a simple solution if possible.
You might want to check the Node comments module. It allows you to use nodes as comments, which makes it possible to use CCK fields in them.
The currently maintained 2.0 version is still in beta, though.
You'll have to wait for Drupal-7 with fields in core before something like that is available. Currently there is no module/patch etc. that allows you to do something like that.
If you really want to, you could create a module from scratch, but that would be quite a challenge in itself.

Resources