Checking for node-add mode in page.tpl.php
In my page.tpl.php
I have an ‘if’
statement that checks to see what node is being used and then add a class to the ‘container’
element relative to the node i.e.
<div id="container" class="clear-block <?php if ($node->type == 'card'): ?>card-node-type<?php endif ?>">
开发者_运维问答But I would also like to add a class to the ‘container’
element in the page.tpl.php
if I’m adding a new node ‘/node/add/card’
but I don’t know how to test for it as it is not a node type. How would I go around testing for this?
Many thanks
A better solution would be to check the args
in the preprocess_page function and then add a variable you can print. You could make that dynamic to work for any node type.
I've sorted it. I duplicated the page.tpl.php
and renamed it to page-node-add-card.tpl
.php (card being the node type I'm adding) and then added the class to the element in that file.
精彩评论