By preper on
I'm trying to create a new region into the node. I applied all the steps explained here: http://www.kirkdesigns.co.uk/drupal-6-how-embed-region-node
but it gives an error like this:
Fatal error: Cannot redeclare newswire_preprocess_node() (previously declared in C:\xampp\htdocs\themes\newswire\template.php:203) in C:\xampp\htdocs\themes\newswire\template.php on line 239
It is about these codes:
function newswire_preprocess_node(&$vars, $hook) {
$vars['node_advert_top'] = theme('blocks', 'node_advert_top');
}
when I add these codes to template.php file site gives fatal error.. what should I do?
Comments
Tell us..
What you put in your info file, template file and your page tpl, Works every time for me!
1-to newswire.info I added
1-to newswire.info I added tihs code:
regions[node_advert_top]= node advert top
2-to node.tpl.php I added tihs code:
endif;if ($node_advert_top && !$teaser && $node->type == 'story'):print $node_advert_top;3- to template.php I added this code:
function newswire_preprocess_node(&$vars, $hook) {
$vars['node_advert_top'] = theme('blocks', 'node_advert_top');
}
I haven't make any change in my page.tpl.php becase I want to see this region inside the nodes.
when I add the 3. step to my template.php ıt gives error like this:
Fatal error: Cannot redeclare newswire_preprocess_node() (previously declared in C:\xampp\htdocs\themes\newswire\template.php:113) in C:\xampp\htdocs\themes\newswire\template.php on line 235
how can I solve this problem?
As far As I Know
You can only have one function in your template.tpl ie 1 instance of newswire_preprocess_node() not 2
Delete step 3 and see what happens.
when I delete step 3 there is
when I delete step 3 there is no error, but I can't see the region. It shows me the new region in the admin block list but when I choose this new region for a block, I can not see this block on the page..
I would try
Going back to basics, You have identified the new region correctly in the theme info file, now delete your changes to node.tpl and try a simple php print (no logic!) in your page.tpl, Clear the cache and see what happens. Do you have any code in the block?
thank you so much ludo1960.
thank you so much ludo1960. I deleted function newswire_preprocess_node (3. step) and 2. step from the node.tpl file and I add just
print $node_advert_top;code to the page.tpl file then it work. It show the region. But this shows the region in every page and I just want to see this region only in the node-content_type.tpl. because I divide the $content and I want to place this region into the node.what should I do?
I found something about that but I could't apply this because I don't know much about codes: http://www.nicklewis.org/node/846
ok
I have only ever done this with page.tpl, so I dont know if node.tpl will work, but try put the code into node.tpl, and delete the code from page.tpl, don't forget to clear the cache and see if it works!
Oh and what code is you are trying to put in the new region? maybe there is another way of doing it.
Good luck!
PS why not try page-content type.tpl ?