开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜