Creating content in a block in Drupal 6 - drupal

By default for creating content a new page is opened. I want to do this inside a block. A block where there will be some fields like title body taxonomy terms and a create content button. How can I do this?

The form block module will do what you want.
You could you do the same thing in code, using hook_block to create a block. And using
drupal_get_form to render the form.

Try the Panels module.
http://drupal.org/project/panels
It will let you override and re-arrange the node add/edit form.
But, as Jeremy stated, to use this form on other pages of the site you will need to do something custom like hook_block and invoke drupal_get_form.

I agree with the answers from Jeremy and Kevin, but want to give another one.
You can use views to create the block! All you have to do is create a new view display with a block display. Add the fields you want to show, add a link field for the node/add/foo link and give it a node id filter or default argument. Here you have to choose the node id of the node to display in the block. Done!
What's nice with this solution? You can use almost every feature of views theming, drag and drop field ordering, adding new fields is cheap and no extra modules. ;)
Regards
Mike

Related

Need custom Drupal view displayed in header node

For a Drupal site I'm building, I've used the Views module to create a custom view that shows the top 10 most popular taxonomy terms. I'd like this list to show up in my site's header but I'm having trouble accomplishing this. I can get the header to display a link to the page for the view, but haven't figured out how to actually display the content of the view in the header node.
Also, if there's a better way of accomplishing what I'm trying to do, I'm all ears!
You should create view with the "block" display. This block can be placed in any region using standard block/theme functionality.
If you don't have "header" region, you can create your own. See this link for details.
https://drupal.org/node/1088718
Maybe, i do not quite understand you question (actually, phrase "header node" confused me, you mean header area/region?). If you need to display view on the node page, you can use views_attach ot eva modules.
Option 1:
Create a region in your theme.
Render the region on your theme page.tpl.php
Create a block display of you view and assign it to that region.
Option 2
You can create a view and then embed it in your theme file using views_embed_views. For details https://api.drupal.org/api/views/views.module/function/views_embed_view/7
Hope this solves your problem

drupal replacing default nodes with views page

I have created a page view using field style to display a list of teasers as I want. fields configuration in views allows us to link the field to it's node. but what if we have created view for node detail page and want field to link to it's relevant view.
I had the same question, and after a bit of research this is what I've concluded:
The views module isn't intended to replace a default node view. I say this because of the level of difficulty involved in doing this and the lack of information on how to accomplish this. Ryan Weal has posted a way to accomplish this by editing your node template that doesn't look too difficult to accomplish, and here is the link.
However, it seems that a more popular solution, especially if you are like me and don't like to get into editing theme files. You can use the Display Suite module to effectively reformat the default node content as you would like.
I'm not sure if I understand you properly, but it sounds like you are wanting to display a view in a page view of a node?
In order to do this, you could:
create a small module, using hook_nodeapi() or one of the D7 replacements for this function in order to insert the output of the embedded view into this page's content, by conditionally adding a $content element when the node is of the appropriate id
or (easier, but requires allowing input type PHP) embed the view right on the page.
http://thedrupalblog.com/embedding-view-drupal-6-using-views-embed-view for information on embedding views

create custom menu in views based on drupal node's cck field

I have a series of committees each one has multiple types of content ex: home page, members page, links page along with a cck field with the name I would like to create a menu block in views for each committees pages based on the value of the name in the cck field and print the only one block to all the pages. is their a way to use tokens in views to accomplish this or a separate module that will accomplish this.
The easiest way may be to just create a block view that displays an li list of the cck field for each committee. You can then style this like your menu.
I found a way to do it after continuing to look using views arguments and default php argument i created an if elseif statement for each committee.

how to add a select box in a region of an created page in drupal

I want to create a list box in a region that has been created by me. Any help would be highly appreciated! I dont understand how to go about it. How can I add just a list box in the existing page?
You should create block (html or php filters should be enabled), put there your list box html code, then place this block into region.
But, using drupal way is recommend - drupal api - create simple module, add form function with list box (select field) and call this form from block hook.

Drupal Views of nodes to show node comments

I've encountered a Drupal problem: I'm using the Views module for rendering nodes of a kind, based on the user id of it's author (it is a Content Profile actually). I want the view to show the comments for the node, just like in node/%. I could not find any option in views or any relevant module. Am I in the wrong direction and should reorganize stuff for this...?
Any ideas, how can it be done?
Regards,
Laci
Using views is really not the best plan of action. You should instead create a node template in your theme and customize it. If needed you can put some logic in a preprocess function. It requires more coding but will get you where you want.
If you use view node display type
Check in it's settings show comments
if you use view fields display type
Use relationship to comments and select fields you need and theme them
I know this is old request, but I was just struggling with the same issue and came across this post. I thought it'd be helpful to share my solution.
I'm using Drupal 7, with Views 3 and Display Suite.
In your view, choose the display in question.
Under Format, click the first link to the right of 'Show'.
Choose 'Content' (or 'Display Suite' in my case).
Click 'Apply'.
On the next screen, you'll have the option to 'Display comments'. Check this box and save your view.
You should now see the comments displayed under each item in the view.
You could create a second view (with URL e.g. /comments/% where the placeholder will be the node ID, and not the comment ID) that lists comments for a given node, with a contextual filter to only show them based on the NID in the URL.
Then, add that view to the footer (as a 'view area') of the single-node view you've already got.
There's some tweaking required for layout (inline fields etc.) but the basic structure should work.

Resources