简体   繁体   中英

Quickpost form on Drupal front page

Hey, I'm quite new to Drupal and am having some issues with implementing a node form on the front page of the site.

I want to have a really simple quick post form on the users front page when they are logged in, just a few fields and a submit button, no advanced options or anything.

Is there a really simple way to do this by placing some php in the front-page.tpl.php file?

Yes and no. This is not the drupal way of doing things- although you COULD make it work this way.

If you are looking for a simple solution, try a module like webform and put it on the front page. You can do this by either creating a page and setting it as the front page (under site information in the admin menu), or by creating a block, putting it in the 'content top' region of your theme, and in the configure block setting it only to display on (a special keyword that means frontpage).

Hope this helps! Chris.

I think what you are looking for is http://drupal.org/project/webformblock . (also requires the webform module)

Create a region on the front page and just put this block in it. You can set options in the block to only appear on the front page.

Or you could just invoke the block directly in the tpl.php file.

http://drupal.org/node/26502

If your login goes to the /user page you can use the webformblock module ( http://drupal.org/project/webformblock ) to configure a Webform to only show up on the "user" page under site building > blocks > configure (next the the webform block). You can also check the option there to only show the block for authenticated users or another role of your choice.

You do not want to create a form without going through Drupal's form API, as you lose a lot of security features and there are many tools out there already that make it easy to generate and maintain forms through the Drupal interface. As the above answers suggest, webform is the Drupal way to create quick forms. And I think you will love the interface.

http://drupal.org/project/webform

Thanks for all your help guys. I tried the webformblock module and whilst it did fit the bill, it required me to create a new content type (maybe I wasn't using it right?).

In the end, after searching I found the Form Block module http://drupal.org/project/formblock which fitted my needs perfectly. It can be configured for existing content types really easily.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM