Community & Support

'template.php' when theming multiple CCK Input Forms

Hi All - searched all over for this, it has to be covered somewhere, but I can't find it. I've themed two CCK input forms, however I can not figure out how to register both *edit.tpl.php files in template.php. Currently, I can only register one template at a time.

function arthemia_theme($existing, $type, $theme, $path) {
    return array(
    'd_activity_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-d_activity-edit',
    ),
  );
}

The second theme file is node-d_activity-edit.tpl.php.

What do I need to do to register a second CCK input template?

Thanks!

Comments

.

Some of my tips here might help out: http://www.davidnewkerk.com/book/125
The user profile one uses template.php, and should be possible to adapt just as well to a CCK form. Hope this helps :)

hey Keyz...thanks for the

hey Keyz...thanks for the quick response. I've already got the templates up and working - maybe I missed it in your documentation (which is awesome by the way), but I'm looking to register two *.tpl.php templates within template.php. Did I miss an example of that in your material? Seems so simple...I found some posts about doing this in 5.x, but the functionality is not the same in 6.

Hey Keyz thanks for this. I

Hey Keyz thanks for this.
I was also searching for a solution to theme CCK input forms !
You saved me time !!!

There is also updated documentation now :Theme a CCK input form for CCK2 (thanks drupal-id.com).

----------------------------------------------------------------------------------
@flying_q

Not sure about this but i think all you have to do is to return one more array element in your arthemia_theme() function... something like this:

function arthemia_theme($existing, $type, $theme, $path) {
    return array(
    'd_activity_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-d_activity-edit',
    ),
    'another_custom_tpl_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-another_custom_tpl-edit',
    ),
  );
}

Please correct me if i am wrong here (i'm new to theming...)

http://www.moriasnow.gr
ReliabilityConsistencyFeedback ------ NeverAchievable -------

fan....99.9% sure i tried

fan....99.9% sure i tried this and it was only accepting the last theme template in the array - but I could be wrong. i'll try again and report back shortly.

Yup...only registers one of

Yup...only registers one of the themes...

used

function arthemia_theme($existing, $type, $theme, $path) {
return array(
    'd_activity_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-d_activity-edit',
    ),
);
return array(
    'd_special_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-d_special-edit',
    ),
  );
}

-

There must be something wrong with the code above, the function cannot return a value twice, rather it must return an array of arrays...

See the API documentation for hook_theme here: http://api.drupal.org/api/function/hook_theme/6

If you have a solution please post the code that worked ... ;-)

Sorry i don't have have time now to check and find a solution...

http://www.moriasnow.gr
ReliabilityConsistencyFeedback ------ NeverAchievable -------

Jackpot, thanks for the link

Jackpot, thanks for the link and tip - 'array or arrays'...so simple.


function arthemia_theme($existing, $type, $theme, $path) {
return array(
    'd_activity_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-d_activity-edit',
    ),
    'd_special_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-d_special-edit',
    ),
  );
}
nobody click here