简体   繁体   中英

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.

您可以检查URL参数如图所示这里

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM