用于确定您是否正在编辑节点的 Drupal 主题代码

发布于 2024-08-30 12:44:12 字数 60 浏览 14 评论 0原文

有谁知道检查你是否处于编辑模式的php代码?我想编辑我的主题在编辑模式下的外观,因此需要确定我是否是这样。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

罪#恶を代价 2024-09-06 12:44:12

您可以检查网址参数,如此处所示。

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

You can check url arguments as shown here.

if(arg(0) == 'node' && arg(2) == 'edit'){ /*...*/}
宛菡 2024-09-06 12:44:12

您还可以创建一个页面模板来处理此问题。从 http://drupal.org/node/190815 检查:

建议的模板文件列表
按照具体顺序
内部路径。提出了一项建议
对于当前路径的每个元素,
尽管数字元素不是
进行后续建议。为了
例子,
http://www.example.com/node/1/edit"
将导致以下结果
建议:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文