如何在Drupal中创建一个不会自动呈现导航链接的新路径/菜单?
我正在尝试在Drupal中创建一个没有显示在导航菜单中的简单页面回调.
我有一个名为的模块helloworld.
该.module文件包含以下内容
function _helloword_page_callback()
{
return array('#markup'=>'The quick brown fox says hello, and the lazy dogs thanks you
for following conventions.');
}
function helloworld_menu()
{
$items['helloworld'] = array(
'title' => 'Hello World',
'page callback' => '_helloword_page_callback',
'access arguments' => array('content'),
'type' => MENU_CALLBACK
);
return $items;
}
Run Code Online (Sandbox Code Playgroud)
这成功地在网站上公开了一个URL
http://example.drupal.com/helloworld
Run Code Online (Sandbox Code Playgroud)
但是,我仍然在左手(Bartik)导航菜单中获得了一个链接,尽管使用了
'type' => MENU_CALLBACK
Run Code Online (Sandbox Code Playgroud)
那么,为什么这不起作用?我正确配置菜单项吗?更可能的问题:我如何误解菜单类型常量/系统的使用?是否有其他缓存来清除它
drush cc all
Run Code Online (Sandbox Code Playgroud)
会不会照顾?我可以采取哪些其他步骤进行调试?
我搜索了这个,但只发现了与.tpl文件相关的结果.我想从我的模块覆盖一个主题函数(例如theme_user_list).我该怎么做?
我在localhost上运行Drupal 7.4,我已经下载了一些主题/模块,但是我无法安装它们.我去管理/模块,例如,选择'上传模块或主题存档进行安装',从我的文件系统中选择tar.gz,并在安装之前我被要求提供FTP用户和密码而无法提前.
我在本地工作,所以我想也许我在安装过程中犯了一些错误.我怎么能纠正这个?在将站点移动到服务器之前,我必须在本地进行大量测试.
就像问题一样 - 我在Drupal 7核心下的Views模块中看不到"空文本"功能.有页眉和页脚,但空文本已经消失.
我有一个类似于我之前的问题(Drupal 7视图按动态分类术语过滤),它只是反过来.
我有一个"合作伙伴"内容类型,每个类型都有自己的分类术语.另一种内容类型是具有来自"伙伴"词汇表的多个术语的常规页面.在我的常规节点中,我想在视图块中包含一些"伙伴".
视图应仅过滤那些相关的伙伴节点(标记有常规节点标记之一的节点).
可以这样做吗?问题是我无法通过上下文过滤器从URL获取术语名称...
我在Drupal 7中有一个名为"group_imagecache"的field_group.如何以编程方式删除它?
我试过阅读代码,它似乎使用ctools,但我宁愿不使用ctools.
我正在为drupal 7网站的首页设置模板,但我遇到了困难.我将文件保存在正确的文件夹中,清除了所有缓存,并刷新了主题页面和浏览器页面.有什么我想念的吗?为什么这不起作用?
我有一个相当昂贵的服务器调用,我需要缓存30秒.然而,似乎我无法使缓存过期.
在下面的代码中,在第一次缓存之后,即使在time()+ 30秒之后,它也永远不会超过$ return-> cache_data.
注意,我甚至可以打印$ cache-> expire,它肯定设置为30秒前的时间,永远不会更新.
我已多次手动清除缓存以确认我得到相同的结果.
这有什么不妥吗?
function mymodule_get_something($id) {
// set the unique cache id
$cid = 'id-'. $id;
// return data if there's an un-expired cache entry
// *** $cache ALWAYS gets populated with my expired data
if ($cache = cache_get($cid, 'cache_mymodule')) {
return $cache->data;
}
// set my super expensive data call here
$something = array('Double Decker Taco', 'Burrito Supreme');
// set the cache to expire in 30 seconds
cache_set($cid, $something, 'cache_mymodule', time() + …Run Code Online (Sandbox Code Playgroud) 我可以在Drupal模板文件中使用令牌替换吗?我正在尝试这个:
$author_uid = "[node:author:uid]";
$nid = "[node:nid]";
Run Code Online (Sandbox Code Playgroud)
但它不起作用.如何在node.tpl.php模板中正确使用令牌替换?
如何覆盖drupal首页node.tpl文件?我试过各种各样的
node--front.tpl.php
page--node--front.tpl.php
page--front--node.tpl.php
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
覆盖主页节点的文件名是什么?(我在drupal 7工作)