Linda
Linda

Reputation: 2247

Drupal theme code to work out if you are editing a node

Does anyone know the php code to check if you are in edit mode? I want to edit how my theme looks when in edit mode so need to work out if I am or not.

Upvotes: 5

Views: 3737

Answers (2)

lazysoundsystem
lazysoundsystem

Reputation: 2149

You can also make a page template to handle this. Check this from http://drupal.org/node/190815:

The list of suggested template files in order of specificity based on internal paths. One suggestion is made for every element of the current path, though numeric elements are not carried to subsequent suggestions. For example, "http://www.example.com/node/1/edit" would result in the following suggestions:

  1. page-node-edit.tpl.php
  2. page-node-1.tpl.php
  3. page-node.tpl.php
  4. page.tpl.php

Upvotes: 2

Kniganapolke
Kniganapolke

Reputation: 5393

You can check url arguments as shown here.

if(arg(0) == 'node' && arg(2) == 'edit'){ /*...*/}

Upvotes: 11

Related Questions