0

I created a content type "test", and I want to overwrite the add "test" content page (http://www.example.com/node/add/test); for example, I want to show something on the right part of the page. How can I do it?

the following is i want to do:

i used garland theme as my site's admin theme and my custommed theme company as my site's template. i created a content type named "hello" this content type is used for anonymous to submit content, the page's layout is (header, left, right, footer) some static content and the site navigation locate on the header. the left part is the form which is used by the anonymous to submit content. the right part will be put into some blocks which are generated by the views module. now the default create hello content page for the anonymous is garland theme's create content page. how to change the page shows like the above layout as what i said. thank you.

  • 1
    Do you want to override the page or just add a block? – Jody May 7 '11 at 13:45
  • i want to override the page. – enjoylife May 7 '11 at 13:58
  • 1
    Explain what exactly you are trying to do. – Berdir May 7 '11 at 16:29
  • I agree with Berdir; as it is, the question is quite too generic. Overwriting the page returned in /node/add/test is not different from overwriting any other pages; you have just two options depending on how that page content is created. If it's created using the form API, then use a hook; if it is not created using the form API, then you use a different hook. – kiamlaluno May 7 '11 at 17:15
  • i have updated the question. hope i explain it clearly. – enjoylife May 8 '11 at 3:22
1

Maybe implement hook_theme() in your template.php and add an extra template for the test_node_form:

return array('test_node_form' => 
    array('arguments' => 
        array('form' => NULL), 'template' => 'test-node-edit'
    )
);

Now you can write a test-node-edit.tpl.php for the form. But that's only for the form, not the whole page.

  • if only can alter the form? what's the difference between you way and using the hook_form_alter()? thank you. – enjoylife May 8 '11 at 3:09
  • The diffrence is that you can theme the form with a template. You can also use the YOURTHEME_preprocess_test_node_form() to modify the $vars you can use inside your template. You could take a look at drupal.org/project/node_form_template for a diffrent aproach. – nonsenz May 8 '11 at 16:30
  • Take a look at api.drupal.org/api/drupal/includes--theme.inc/function/… . Near the end (beginning with the last commentblock) of the function code you can see how the arg() function is used to "suggest" page-templates. – nonsenz May 8 '11 at 19:54
1

The Panels module is a good way to do this. Watch this video http://www.gotdrupal.com/videos/drupal-panels

It will allow you to override your add 'hello' page with a page that you can fully customize.

  • if i don't use the panel module,is there a way to get that? – enjoylife May 8 '11 at 6:34
  • Why not use it? – Matthew Hui May 8 '11 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.