E
E
Evgeny Kuznetsov2012-04-30 00:25:52
Drupal
Evgeny Kuznetsov, 2012-04-30 00:25:52

Drupal 7 and contact form?

Good day.
The essence of the question is this.
You need to make a feedback form, but not a standard one, like the Contact module, but a human one (placeholder and js a bit). Say that it is necessary to use webform.
I put it and I do not find a single similarity with the instructions on the Internet.
I myself have never used any free cms, I saw drupal for the first time yesterday.
And you just need to make a website on this cms. (I would have done it on my cms a long time ago). 2nd day I'm already suffering.
So who is aware of my question, can you tell on your fingers how I can solve this problem?
And how can I display the last few articles on the main page? More precisely, how to call it in the page.tpl.php file?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Ritsuka, 2012-04-30
@Ritsuka

You need to make a feedback form, but not a standard one, like the Contact module, but a human one (placeholder and js a bit)

If the differences from the standard form are only in the design and some default values, then use the standard one. Each element has its own constant id, cling to them and add whatever you need via JS.
If you need a more serious change in the interface and the addition of some content (but not form fields), then you can also get by with the system module, using the ability to template this page through themes:
1. In the theme folder you are working with, edit the template. php. Add/modify a function:
function %имятемы%_theme() {
  return array(	'contact_site_form' => array(
          'render element' => 'form',
          'template' => 'contact-site-form',
          'path' => drupal_get_path('theme', '%имятемы%').'/templates',
        ),
  );
}

Add a function:
function %имятемы%_preprocess_contact_site_form(&$vars)
{
  $vars['form_html'] = drupal_render_children($vars['form']);
/*	$vars['name'] = drupal_render($vars['form']['name']);	
  $vars['email'] = drupal_render($vars['form']['mail']);
  $vars['subject'] = drupal_render($vars['form']['subject']);
  $vars['message'] = drupal_render($vars['form']['message']);
  $vars['copy'] = drupal_render($vars['form']['copy']);
  $vars['submit'] = drupal_render($vars['form']['submit']);	*/
}

2. Create a contact-site-form.tpl.php file in the theme folder. It will be passed the $form_html variable, which will contain the original form code, and it will be executed on the feedback page. Optionally, by uncommenting the code from the block above, you can pass all the form elements there separately. All of them will come in the form of ready-made html-code. Basic example of this file:
<p>Пишите письма!</p>
<div class="submit-contact-form"><?php print $form_html; ?></div>

And how can I display a few recent articles on the main page

1. Install the Views module.
2. Create a view in it with the necessary filters.
3. Create a block for it
4. Drag the block to the area you need and limit the display to only the main page.
PS I hate Drupal for an excessive amount of dreary manipulations, and therefore I abandoned it a long time ago.

J
jane jane, 2014-01-20
@ru_janex

I made a feedback form for the diploma in the form of a node, which is allowed to be created by anonymous people, they are automatically created unpublished.
and separately there you can already edit the form, put jquery scripts through murkUp, and so on ...
And look.
1. you do two views. one - on which unpublished.
2. put the Rules module, you prescribe an action in it, so that after someone comments this review, it would receive the status published. in the same Rules you write that this comment should be sent to the mailbox specified in the form field. (which the anonymous person indicated)
(there may be a problem only in setting up the server, SMTP)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question