简体   繁体   English

用Drupal开发模块

[英]developing module with drupal

I have a website which is up and running on drupal. 我有一个在drupal上运行的网站。 Its product based website. 其基于产品的网站。 I developed by creating my own tables and writing php code using php filters. 我通过创建自己的表并使用php过滤器编写php代码进行开发。 I never used module concepts. 我从未使用过模块概念。 Since the site is running well, so i am thinking to move to module concept. 由于站点运行良好,所以我正在考虑转向模块概念。 so wanted some help here, like how to do it.. i have gone through module development concepts also. 因此想要在这里提供一些帮助,例如如何做。.我也经历了模块开发的概念。

requirement. 需求。 1. Admin should be able to create new products like Mobile, Camera. 1.管理员应该能够创建新产品,例如手机,相机。 2. He should be able to define product properties and properties for which user will rate on. 2.他应该能够定义产品属性以及用户将对其评分的属性。 3. Admin/ second admin should be able to create new sub products under products like mobile - nokia 8850 , nokia 9980 where he enters details of product properties also. 3.管理员/第二位管理员应该能够在移动产品-nokia 8850和nokia 9980等产品下创建新的子产品,他还可以在其中输入产品属性的详细信息。 4. A listing page for all the sun products under main product. 4.主产品下所有防晒产品的列表页面。 and from listing page we go to to main sub product page where user rates the product. 然后从列表页面转到主子产品页面,用户在该页面上对产品进行评分。

My confusion : should i create a new table or drupal takes care of all the requirements. 我的困惑:我应该创建一个新表还是drupal满足所有要求。 and how do i start with it. 以及我如何开始。

update : clear picture of requirement ex : 1. 1st i add a product "MOBILES" 2. Then i add properties for this main product. 更新:明确要求ex的图片:1.首先添加一个产品“ MOBILES” 2.然后添加此主要产品的属性。 3. Then i start adding sub products under MOBILES ie nokia 1100, samsumg 2200 and etc. while adding sub products, in this page it gives me a text box for all the propeties i defined while creating the main product MOBILES . 3.然后,我开始在MOBILES下添加子产品,即诺基亚1100,samsumg 2200等,同时添加子产品,在此页面中,该页面为我提供了我在创建主产品MOBILES时定义的所有属性的文本框。 So is this possible using CCK. 使用CCK也是可能的。

It sounds like you could do all of this with modules, without needing to do any php coding at all. 听起来您可以使用模块完成所有这些操作,而根本不需要进行任何php编码。 Check out (if you haven't already) cck , views , and fivestar . 退房(如果你还没有的话) CCK视图 ,和五星

You're right to consider using modules and following the "Drupal way". 您可以考虑使用模块并遵循“重复方式”。 Use CCK + Views and Drupal will take care of the table maintenance and querying for you. 使用CCK + Views,Drupal将负责表维护和查询。

As already mentioned, you will need to get familiar with the CCK module. 如前所述,您将需要熟悉CCK模块。 This module will allow you to create new "content types", which in your example would be the different product types and their attributes. 该模块将允许您创建新的“内容类型”,在您的示例中将是不同的产品类型及其属性。 Here is a good overview video on CCK. 这是有关CCK的很好的概述视频 With CCK you can define new content types and Drupal will create the basic content creation forms for you and hide spare you from all the database details when you're working with it. 使用CCK,您可以定义新的内容类型,Drupal将为您创建基本的内容创建表单,并在您使用它时从所有数据库详细信息中隐藏您。

The Views module is essentially a query builder and will allow you to create views of your content. Views模块本质上是一个查询生成器,将允许您创建内容的视图。 There are all sorts of related modules that can help you render your data as charts, grids, lists, slideshows, tables, etc. 各种各样的相关模块可以帮助您将数据呈现为图表,网格,列表,幻灯片,表格等。

There is a slight learning curve but once you get past it you'll be able to build new things pretty quick. 学习曲线有些许变化,但是一旦您克服了它,就可以很快构建新事物。

Update: Just another thought, if you are really needing to create some kind of classification system you should look at Taxonomies . 更新:另一个想法是,如果您确实需要创建某种分类系统,则应查看分类法

为了响应您的更新,CCK和Node Hierarchy之类的声音应该可以满足您的所有需求。

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

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