如何使用 Drupal 使用各种节点类型制作多步骤表单

发布于 2024-10-15 01:53:56 字数 502 浏览 1 评论 0原文

我正在创建一个非常基本的分类网站。在这个网站中,我将有各种内容类型;例如:

  1. 汽车(具有 cck 字段:年份、公里、颜色
  2. 房屋(具有 cck 字段:楼层数、花园(是/否))

所以每个“元素”都是一个内容类型。

我列出了所有我向用户显示的视图中的内容类型,然后单击链接转到“创建类型的内容类型(单击的类型)”,

但我无法摆脱“创建新类型”。创建页面顶部的“car”(反映了“drupalish”行为),

我希望以更方便的方式使用它,例如三步形式:

  1. 选择类别
  2. 选择您的选项
  3. 注册以发布您的新分类。

我见过 ctools;它提供了“几乎”的多步骤行为;但是我无法想象将我的所有内容类型都“硬编码”在一个模块中,

或者是否有人已经实现了这种设置 。有一种模块可以做到这一点。我想为每种类型的分类保留一个内容类型(网站管理员现在已经习惯了该界面)

I'm creating a very basic classifieds website. In this website i'll have various content-types; such as :

  1. Car (which has the cck fields : year, kilometers, color
  2. House (which has the cck fields : number of floors, garden (yes/no)

So each 'element' is a content-type.

I'm listing all the content-types in a view that I display to the user aand then clicking on a link goes to 'create content type of type (clicked type)'.

It's working pretty well; but i can't get rid of the 'create new car' at the top of the create page (which reflects the 'drupalish' behaviour).

I'd like to have it in a more conveniant way such as a three step form like :

  1. Choose category
  2. Choose your options
  3. Register to post your new classified

I've seen the ctools; which provide 'almost' the multistep behaviour; however i can't imagine having all my dozen content-types being 'hardcoded' in a single module.

I wonder if anyone has achieved this kind of setup or if there's a kind of module that can do the trick. I'd like to keep a content type for each type of classified (the webmaster is now used to the interface).

Any help, starting points would be appreciated.

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

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

发布评论

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

评论(1

不一样的天空 2024-10-22 01:53:56

第一步我们必须解决一个类似的问题。为此,我们创建了基本上是对 /node/add 页面(列出所有内容类型的页面)的覆盖,您已经完成了这一点。要更改标题,最简单的方法是创建一个 yourtheme_preprocess_page() 函数,该函数会在 url 为 /node/add 或 node/*/edit 时更改标题。

但是:我强烈建议切换到对所有列表使用 1 种内容类型的系统。我们创建了一个非常相似的网站,在使用不同的内容类型之后,很明显,拥有一种带有条件显示字段的内容类型是一个更加明智的解决方案。对不同的产品类型使用类别,然后使用条件字段模块隐藏和显示正确的字段,效果会更好。

http://drupal.org/project/conditional_fields

这是在页面中设置标题的示例片段预处理函数:

设置节点/添加页面的标题:

  if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == '') {
    $vars['title'] = 'Choose an Industry';
    $vars['head_title'] = $vars['title'] . " | " . variable_get('site_name', "Industry Trader");
  } 

For the first step we had to solve a simular problem. To do so we created what was basicly an override of the /node/add page (the one that lists all the content types), which you've done. To change the title the simplest is to create a yourtheme_preprocess_page() function that changes the title when the url is /node/add or node/*/edit

However: I would strongly suggest switching to a system that uses 1 content type for all listings. We created a very simular site, and after working with different content types it because clear that having 1 content type with fields that were displayed conditionally was a much more sane solution. Using categories for the different product types, and then using the Conditional Fields module to hide and show the correct fields worked much better.

http://drupal.org/project/conditional_fields

Here is and example snippet for setting the title in a page preprocess function:

Setting the title on the node/add page:

  if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == '') {
    $vars['title'] = 'Choose an Industry';
    $vars['head_title'] = $vars['title'] . " | " . variable_get('site_name', "Industry Trader");
  } 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文