简体   繁体   English

Drupal authcache-通过Ajax加载动态内容

[英]Drupal authcache - load dynamic content through ajax

I'm using Drupal 6 with authcache . 我正在将Drupal 6与authcache一起使用 I've read that you can load dynamic content by using ajax, even when the whole page is cached with authcache. 我已经读到即使使用authcache缓存整个页面,也可以使用Ajax加载动态内容。 In my template files, I've used this code to show Edit and Delete links: 在模板文件中,我使用以下代码显示“编辑”和“删除”链接:

<?php if ($user->uid == $node->uid || in_array('moderator', array_values($user->roles))|| $user->uid == 1): ?> <span class="edit"><?php print l('Edit', 'node/' . $nid . '/edit'); ?></span> <span class="delete"><?php print l('Delete', 'node/' . $nid . '/delete'); ?></span> <?php endif; ?>

This checks if the user is either: The owner of the content, a moderator, or the super administrator. 这将检查用户是否为:内容的所有者,主持人或超级管理员。 How could I make that part load with ajax? 我怎样才能用ajax加载该零件?

I would suggest that you try Authcache ajax docs or on the example.com/admin/build/modules enable the authcache example block module (it is axample on how to achieve this) and try to go through this module for an inspiration. 我建议您尝试使用Authcache ajax文档或在example.com/admin/build/modules上启用authcache示例块模块(有关如何实现此功能的示例),并尝试遍历该模块以获取启发。 I haven't tried to test it yet but I came over that during installation of the Authcache module. 我还没有尝试对其进行测试,但是我在安装Authcache模块的过程中遇到了问题。

If I were you I would try to assynchrounously load the content through ajax link to your links function. 如果我是您,我会尝试通过ajax链接异步地将内容加载到您的链接功能。

Hope it helps. 希望能帮助到你。

Lukas 卢卡斯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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