I used to theme CCK input form with a template file called by template.php like this:
function phptemplate_node_form($form) {
if ($form['form_id']['#value'] == 'news_node_form') {
return _phptemplate_callback('news_form', array('form' => $form));
}
if ($form['form_id']['#value'] == 'event_node_form') {
return _phptemplate_callback('event_form', array('form' => $form));
}
}
and than using a event_form.tpl.php file.
Everything worked since tonight when working on a new website:
The template file doesn't work and the form stay untouched.
Anybody knows if there have been changes to CCK that can cause this beahviour?
Any help appreciated.
Comments
Comment #1
dodorama commentedI didn't mean to post it twice.
Anyway the crazy thing is that the template for the news form works. So I'm at the point that I can't understand what's going on.
Maybe it's just too late...
Comment #2
dodorama commentedSince this issue is stopping me from completing a website I would like to put 20 $ for the guy who knows how to solve this.
Anyone willing to collaborate can contact me via my personal contact form.
Comment #3
dodorama commentedI'm still investigating on this and I discovered that the form ovverride doesn't work if the content type contains a date field.
As soon as I delete the date field from the content type the override works.
I change this to bug and I'll post a n issue to the date field module, too.
Comment #4
gruchie commentedHi, I'm having a similar problem. Like you, I've been trying to use a template file (ficreview_edit.tpl.php) called by template.php to theme my form. So far, the code for the tpl.php file looks like this:
Now, when I try to add or edit the content type, all that displays is the related header (i.e., either "Submit Fic Review" or "Sample Fic Review Title"), the empty "Fic Stats" fieldset and the preview, submit and delete buttons. When I view the source code, only the empty
<div>tags are displayed- as if Drupal has stripped the php tags completely. Bear in mind that this is code I produced after slogging through the "How To Theme CCK Input Forms" tutorial.Now, when I put in something like this
instead, the title field and the group I referenced are printed. When I put the two snippets of code together, the code above is what gets used, and the php code between the
<div>tags is ignored.I'm not a PHP developer or anything, so I'm not sure if I'm just being silly about some element of this. For clarification, I've included a screenshot of what the "Submit Fic Review" page looks like when I've put in only the first snippet of code into my tpl.php file.
Comment #5
gruchie commentedOkay, I think I've sorted this out for myself. How? I went back to the original "How to Theme CCK Input Forms" tutorial and used the template.php code suggested there, but with one or two changes:
If you've looked at the original code before, you may notice that my content type AND my content type .tpl.php file are named the same thing. I don't know if that did the trick, but I just thought I'd point that out.
As for the contents of my tpl.php file, I ran the following code to test that Drupal was reading and using all the php included:
Then, since everything appeared to be fine, I added the following code:
And everything printed out perfectly, in the exact order I put it in, with nothing being left out. Hopefully this helps someone else - I spent quite a lot of time searching up and down and modifying things to get to this point, and it would be lovely to have saved someone else the hassle. :)
Comment #6
knight42 commentedHi
Have been using this method and it works very well, so thanks for the code. Have one small problem though? I can get all the fields to print/work perfectly, but how to do you print taxonomy fields? I have several different vocabs and i cant get them to print at all. Any idea what would be the code for that say if i have a vocab called "cartags"????? Thanks
Comment #7
dodorama commentedprint_r(drupal_render($form['taxonomy']));Comment #8
knight42 commentedexcellent, that works. Would you have any idea how to only print out one vocab (vocab/2)
I have several different vocabs and wanted them spaced out around the form rather than grouped together. I tried
and
But couldnt get either to work. Any ideas? Thanks
Comment #9
karens commentedThe D5 version is no longer being supported. Sorry.