Templating a Drupal Form

I was attempting to customize the look of a form that I create in a module using Drupal. I wanted to add images to a check box form element. This was a very useful link that explained how to call the form via the form id in the template.php file which then allows you to create a form.tpl.php file for custom styling.
http://drupal.org/node/62888#comment-119263

Excellent.

Excellent.

Fantastic instructions. very

Fantastic instructions. very helpful! I'm just starting to use drupal and this is very helpful!

I've installed Drupal 6x on

I've installed Drupal 6x on examplesite.com, and have been developing on a test.examplesite.com, and now I'm ready to migrate my client's real domain (say realsite.org) to use the project I've been developing at test.examplesite.com.

I have my base Drupal install at /public_html/drupal with its own db & db user. For test.examplesite.com I have it installed at /public_html/sites/test.examplesite.com with its own db & db user. There's another instance (test2.examplesite.com) at /public_html/sites/test2.examplesite.com… but I'm only worried about the first.

Basically what I need to do is park realsite.org on my server, and have the site that's been being viewed from test.examplesite.com to now be viewable from realsite.org.

I'm stuck though... Any suggestions?

Thanks! I'm a new drupal fan

Thanks!

I'm a new drupal fan and i'm theming like crazy!

Is it me or drupal is a HUGE phenomenon??

Thanks god for that little drop of water!!

I too was trying to figure

I too was trying to figure out how to do this when we started The Vineyard Voice and ended up doing almost this. We went about it a slightly different way, instantiating the function only when the args were right. In this way we could have separate tpl files for the 'add' and the 'edit' forms. Here's a piece of what I mean:
Essay Writing | Research Paper | Political Science Dissertation

Great find

This is a great link! I remember when Dave and I were trying to figure out how to do this when we started The Vineyard Voice and ended up doing almost this. We went about it a slightly different way, instantiating the function only when the args were right. In this way we could have separate tpl files for the 'add' and the 'edit' forms. Here's a piece of what I mean:


/**
* VIDEO ADD
*/
if ((arg(0) == 'node') && (arg(1) == 'add') && (arg(2) == 'video')) {
function phptemplate_node_form($form) {
return _phptemplate_callback('video_add', array('user' => $user, 'form' => $form));
}
}


/**
* VIDEO EDIT
*/
if ((arg(0) == 'node') && (arg(2) == 'edit')) {
$node = node_load(array('nid' => arg(1)));
if ($node->type == 'video') {
function phptemplate_node_form($form) {
return _phptemplate_callback('video_edit', array('form' => $form));
}
}
}

The technique in the link you sent is much cleaner and our code could be improved upon quite a bit.

I too was trying to figure

I too was trying to figure out how to do this when we started The Vineyard Voice and ended up doing almost this. We went about it a slightly different way, instantiating the function only when the args were right. In this way we could have separate tpl files for the 'add' and the 'edit' forms. Here's a piece of what I mean: social bookmarking tool

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
By submitting this form, you accept the Mollom privacy policy.