Hey there everyone, I have a little issue I'm hoping someone out there can help me with. I'm trying to theme a CCK2 input form and followed the tutorial here on drupal.org, but when I add the code to my template.php file, my entire site goes blank. the code is as follows:

<?php function marinelli_theme($existing, $type, $theme, $path) {
  return array('v-upload_node_form' => array('arguments' => array('form' => NULL),'template' => 'node-v-upload-edit'));
}
?>

just to clarify, as soon as i save my template.php file with this code in it, if i refresh the page or if i try to go to a new one, any one, it just gives me a blank page. no error code even.

I'm a pretty big n00b when it comes to php, so any help would be appreciated. thanks everyone.
-JB

Comments

nevets’s picture

What tutorial did you follow, the code does not make much sense.

gpk’s picture

> gives me a blank page. no error code even
This often indicates a PHP error, in which case you need to check your server error log (and also perhaps Drupal's built-in log).

dabellator’s picture

hey, thanks for taking the time to help me out. the tutorial i was following was here:

http://drupal.org/node/601646?destination=node%2F601646

basically it said to change the template.php (i assumed the one in my current theme folder), then to add a new file that matches the template i specified in the code. im hoping there is a code error cause i cant figure this out!
-JB

nevets’s picture

Your template.php should only have one <?php line (at the beginning of the file). You can remove the ?>.

Content names can not include a '-', so 'v-upload_node_form' does not look correct, I would expect 'v_upload_node_form'

dabellator’s picture

good thoughts, but i've already been there. the <?php was just for the sake of the post, and i've run the gamut of underscores vs. dashes, but have yet to come up with any success. whats frustrating is the more i search, this seems like the code everyone else is using, with success.

any other problems people see?
-JB

nevets’s picture

Another possibility would be that 'marinelli_theme' is already defined in template.php

dabellator’s picture

It doesnt look like there are any other instances of marinelli_theme in the template file, could it be defined somewhere else?
-JB

nevets’s picture

Ok, I installed the marinelli theme, then made it my default theme.

Edited template.php and at the end added


function marinelli_theme($existing, $type, $theme, $path) {
  return array('v-upload_node_form' => array(
  	'arguments' => array('form' => NULL),
  	'template' => 'node-v-upload-edit')
  );
}

and no white screen. So either you have anther issue or your template file node-v-upload-edit.tpl.php has a problem (I do not have a node-v-upload-edit.tpl.php).

dabellator’s picture

thanks nevets, that at least helps me to stop trying to figure out this code and look at other issues. ill look around and see what happens, this helps though.
-JB

dabellator’s picture

baffled as to how you dont come up with an error! ive been working on the site on my localhost, but i just tested it on a live site to see if maybe MAMP had the issue. on the live site i get an error, an unexpected T return from the line: return array('v_upload' => array(

does that offer any clues? i've tried v_upload, v_upload_node_form, and also tried dashes instead, since you used the dash code i had copied and didnt have any troubles.

Could I have something improperly set somewhere else?
-JB

nevets’s picture

I am guessing you have a hidden character causing the problem. Start with the version I pasted or retype the code would be one approach.

dabellator’s picture

youre refering to this code, right?

function marinelli_theme($existing, $type, $theme, $path) {
  return array('v-upload_node_form' => array(
  'arguments' => array('form' => NULL),
  'template' => 'node-v-upload-edit')
  );
}

I took that one and tried it in a few different sites i have going, one with marinelli and clean urls, one with a different theme without clean urls, and i changed the function THEME_theme to match, still getting the unexpected T_return.

looks like this just isnt going to work for me, but i still cant understand why it seems to go for everyone else!
-JB

dabellator’s picture

just to clarify, so that im not way out in left field here, the template.php you modified is the one inside the marinelli folder, correct? thats what ive been working from, the template.php with the theme folder, just wanted to make sure im in the right ballpark at least.
-JB

dabellator’s picture

if anyone comes across this thread and is interested, I realized I wasn't able to cache my database since my theme was breaking down before I could access the performance page, so I added this snippet to the top of my template.php:

drupal_rebuild_theme_registry();

...although I'll have to remove this when I finish setting up the registry.

This has at least allowed me to point at my own template file, now comes the journey to learn how to make that file output the form I want!

Thanks for everyones help.
-JB

gpk’s picture

For info - the normal way of rebuilding the registry is just to visit the themes admin page, tho' I appreciate you can't do that if you get a white screen first! Using a different admin theme might help there.

Also you server error log might help track down the actual cause of the problem.