How to display blocks of text in drupal? - drupal

I'm trying to build a module that lets users with a certain role post messages that will be displayed for users with a different role. I'd like this to simply be one module that handles both these things, however, the furthest I've gotten is setting up the form to post messages.
I'd like to show the posted messages on the same page as the input form (and hide the form for the unauthorised users), but I just can't figure out what I have to do to show the messages. How hard can it be to display some simple text?
So far I've added an item to the menu that links to the page with a form on it.

You could make use of the boxes module to have online editing of this text that other users will see. If you're set on Using your custom Form you could put your text in a block.

The Content Access module will let you restrict view permission for a given content type to users having a certain role.
For setting up the layout, you might want to put the posted messages in a block or use Panels.

Related

Different pages for showing different fields of a single node in Drupal 7

Is it possible to elegantly do this? The idea is, a node of content type "project" has a lot of fields, its url is something like node/5. I want to show some of the fields on that page, and others on node/5/extra, kind of an "extended" page that the user only loads if he is interested in that content (lots of images, in my case, that would slow down the main node page considerably).
I tried the Display suite module, unsuccessfully (it seems it's not really meant for doing what I want). I also saw this blog post, which explains how to add a custom display mode to a content type (other than the Default and Teaser ones that come by default), but I can't get it to work the way I want to either.
I guess you could create a view having the node ID as a default argument from URL. Then you can choose which fields to show or hide

Drupal based on check box flag, change the textbox text as link or normal text

This what I am expecting:
If the user filled the textbox, and if the user checked means, while displaying the content on that time, content should show as a link, if the user is not checked, then it need not to show the link while that content in view mode. See the following image for an illustration.
Not an exact solution to what you want to do but I believe the Link Module will display only text if no url is entered.
You can give users a message saying to leave URL field blank and only enter a TITLE if they want plain text.
UPDATE:
You don't need to code any hooks. The CCK Module adds fields to content types. The Link Module adds link functionality to CCK.
No coding is necessary; this can all be done from the admin panel. If you have no idea what I'm talking about see this video.
http://drupal.org/project/conditional_fields module does exactly what you are trying to accomplish. You can use the link_field of cck along with the conditional fields module. So based on the value in the check-box you can choose to display it in the node view.

Fb like share box in drupal website

I am making a drupal website and have a content type "quotation". The standard way of taking input in drupal is going to the create content in the menu which is not very user friendly considering your normal user.
I want to have an option to create content (i.e quotation) like in facebook, twitter or any other social networking site. A share box where someone can type in his status and can directly create content.
Also, I have two vocabularies associated with my content type and I want to accommodate them as well while using minimum space. So, how should I go about the problem.
Is there any module in Drupal which can help me in doing so or I have to write Jquery code myself.
two vocabularies associated with my
content type and I want to accommodate
them as well while using minimum
space.
Lol, sounds tough. If you want to use minimal space you'll need to simplify the workflow, ie, remove a vocabulary or 2.
You can also do something like this:
$('#node-edit').focus(function (){
// set your node form vocab to display:none and then show them when user actually uses the form
$('.vocab-wrappers').show();
// set your node form buttons to display:none and then show them when user actually uses the form
$('#node-form buttons').show();
});
To hide the vocabularies/buttons until the user is editing the content.
To get a facebook like effect, I suggest you use: http://drupal.org/project/formblock
This should get you the form and the ability to place it anywhere.
You can use form alter to hide certain parts of the form, or a form alter module, there's various options if you look in drupal modules.
http://drupal.org/project/nodeformcols
You also want http://drupal.org/project/auto_nodetitle to make the title optional, and hidden from the form.
Lastly, theme the node form in CSS/JS, making the texarea smaller and whatever other stuff you would like, recommend setting display:none on the field labels.
This should give you the correct idea for making a decent facebook-like form setup.
This should be possible:
http://drupal.org/node/464906
I've never tried it myself though.

Editable content area for user with restricted access

I'm building a blog for a client and they need to be able to edit a paragraph of text in the sidebar. I currently have it setup as a 'Better Text' widget which I can quickly edit for them.
I don't want to give them access to the widgets, etc but they want to be able to edit it themselves. Is there an easy way to add a custom write panel kind-of-thing that's independent of the post & page structure?
I know I could create a separate post category and pull the particular post into the template but i'm looking for something different.
Anyone got any ideas? thanks in advance,
Greg.
Why not just add a a custom field for that specific page, and let them have a login which allows them to edit that content?
The point of using a CMS, is to allow the customer to edit the content themselves.

Drupal: How to show specific view in a particular block

Let's suppose I have created a view that shows some kind of stories.
But I want to show this view in a left-hand bar — not a link to the view, but the view itself.
How can I connect my new view with a fixed block position?
I want to be able to show real view data in various places on my page.
Is it possible or I am limited only to central area and links to views from menu?
Using Views 2.x for Drupal 6.x it's simple to create a block from a view. Every view has a set of 'default' settings and some number of display settings. A display can be a page, a block, a feed or anything else that creative module authors.
To make a block from your view, you just "Add Display" of type "block", override any settings that you want changed in the block (IE - display less items, just a node title, whatever). You then have a block that you can place like any other Drupal block.
edit: Answer to "Can you limit stories to ones that are tagged"? Sure thing. You just add a filter for Taxonomy terms.
Getting a view to display in a block is easy. Once you have created a view and assigned the view as a block position you simply head to blocks in your admin and you'll see the view.
Just select the block and save it. Simple.
If your view doesn't show, check your filters and that the view fields are correct. Usually if they are not showing it is something simple like selecting content published = yes.
You can create views as pages or blocks. As you're not telling exactly which Drupal/Views version you're working with, all I can tell so far is that, after you create the view, you can tell it to display as a block or as a page.
Then go to the blocks settings and set that to the position you want.

Resources