在节点中包含 drupal 模块

发布于 2024-10-08 02:36:40 字数 312 浏览 5 评论 0原文

我对 Drupal 相当陌生……到目前为止,我已经了解了一些方法并敲定了一个自定义模块。我试图弄清楚是否有办法在 PHP 输入格式的节点中包含或嵌入另一个模块。就我而言,我有一个带有几个动态生成的表的节点,我想在同一视图上包含用于文件管理的 WebFM 之类的内容。 drupal 有没有办法做这种事情,或者我完全走错了路?如果是后者,我是否正在考虑创建另一个自定义模块来实现我正在寻找的功能?我真的只需要一些东西让用户能够在同一页面上上传和查看文件(只能由该用户查看)以及其他一些特定于用户的信息。 WebFM 可能超出了我的需要,我想稍微修改一下它的外观,但我认为我可以让它适合我的情况。感谢您的任何指导。

I'm fairly new to Drupal ... I've learned my way around a bit and hammered out one custom module so far. I was trying to figure out if there was a way to include or embed another module in a PHP-input-formatted node. In my case, I have a node with a couple of dynamically generated tables and I would like to include something like WebFM for file management on the same view. Is there a way in drupal to do this sort of thing or am I totally heading down the wrong path? And if it's the latter, am I looking at creating another custom module to achieve what I'm looking for? I really just need something for users to be able to upload and view files (viewable only by that user) on the same page as some other user-specific information. WebFM might be more than I need and I would want to modify its look somewhat, but I thought I could make it work for my case. Thanks for any guidance.

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

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

发布评论

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

评论(2

听风念你 2024-10-15 02:36:40

很高兴您正在制作自己的自定义模块,因此您已经在路上了。

如果我是你,我会亲自将你想要添加到页面的内容放入一个块中,你可以将其放置在节点下方或上方。 block api 非常强大且灵活。

但是,如果您确实想将内容放入节点本身,这是可行的,但要棘手得多。有节点预处理钩子(MYMODULE_preprocess_node()),您可以更改提供给节点的内容,但此时节点的大部分内容已经分组在一起,因此在开头添加任何内容都非常简单,或者节点内容的末尾。但是您可以根据需要在此处添加其他全新变量以在您的node.tpl.php 中使用。

另一种方法是使用 hook_menu 基于节点制作自己的页面。在这里,您可以使用 node_load($id) 收集用于启动节点的参数,节点加载函数实际上构建了节点对象,可以很容易地根据您认为合适的方式操作损坏的节点。然后您可以使用它构建您自己的页面。但是,如果您有自己的内容类型,则可以为该内容类型创建一个模板,并使用 preprocess_node 操作数据,但实际上将从 node_load 获得的节点对象的修改后的输出传递到您自己的基于数据类型的模板

中知道有很多方法可以解决这个问题,每种方法都有自己的挑战。但 Drupal 相当灵活,可以让您轻松访问此类核心数据。

希望能有好的结果......

its great you are making your own custom modules and so you are well on your way.

If I were you I would personally make what you are wanting to add to the page into a block, which you can place below or above the node. The block api is very powerful and flexible.

But if you are really wanting to place the contents into the node itself it is do-able but a lot more tricky. There is the node preprocess hook (MYMODULE_preprocess_node())which you can alter the contents that are fed to node, but by this point much of the node contents has already been grouped together so it is only really simple to add anything to the beginning or end of the node contents. But you can add other completely new variables in here to be used in your node.tpl.php as you please.

The other way is to make your own page based on a node using hook_menu. Here you can gather parameters in which to fire up the node using node_load($id), the node load function actually builds the node object of which it is very easy to manipulate the broken down node as you see fit. Then you can build your own page using this. But saying that if you have your own content type, you can make a template for that content type, and manipulate the data using preprocess_node but actually pass into your own data type based template the modified output of the node object which you get from node_load

I know there are many ways to tackle it, each with their own challenges. But Drupal is fairly flexible in allowing you easy access to such core data.

Hope it works out well....

过潦 2024-10-15 02:36:40

Filefield CCK 模块 可能就是您正在寻找的。

The Filefield CCK module may be what you're looking for.

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