简体   繁体   English

TYPO3:TCA如何将UID作为父UID添加到新表中

[英]TYPO3: TCA How to add UID to new table as Parent UID

I want to create a new content type(Ads), I have created a Ad container in the tt_content table as CType = ' ad_container ', Now i need to put the ads in this container. 我想创建一个新的内容类型(广告),我已经在tt_content表中创建了一个广告容器,作为CType =' ad_container ',现在我需要将广告放入该容器中。 So I wish to create a new table tx_adcontent . 因此,我希望创建一个新表tx_adcontent Each ad container contains multiple ads, and my confusion is that for the front-end rendering I have some other codes to fetch these ad parameters and show in a particular template structure. 每个广告容器都包含多个广告,我的困惑是对于前端渲染,我还有其他一些代码来提取这些广告参数并以特定的模板结构显示。

So to fetch that ads from the particular uid of the current pid, i need a refrence in my new table tx_adcontent as parent_uid, other wise I can't put that ads in respective container.(each page contains multiple ad container. ) 因此,要从当前pid的特定uid中获取广告,我需要在新表tx_adcontent为parent_uid,否则我不能将这些广告放入相应的容器中。(每个页面包含多个广告容器。)

Finaly My Intention is to put parent_uid in the new table tx_adcontent . 最后,我的意图是将parent_uid放入新表tx_adcontent How do I do this with TCA , How do I configure in TCA. 如何使用TCA进行此操作,如何在TCA中进行配置。 Otherwise I need to enter that parent_uid into a text field manualy, is there any automatic field inserting possible there? 否则,我需要parent_uid在文本字段中输入parent_uid ,是否可以在其中插入任何自动字段? (I dont want to show that id in my backend edit form, but need to insert that automatically to db table( tx_adcontent )) (我不想在我的后端编辑表单中显示该ID,但需要将其自动插入到db表( tx_adcontent )中)

Thanks in advance. 提前致谢。

Use the Extension Kickstarter for creating own extension which will allow you to 使用扩展程序Kickstarter创建自己的扩展程序,这将使您能够

  • create new column in existing table 在现有表中创建新列
  • create new table for your records 为您的记录创建新表
  • create a new ContentType and some basic PHP class 创建一个新的ContentType和一些基本的PHP类

etc. Most important is that will create proper SQL schema AND tca configuration of it for your own table , it will contain also pid field by default. 最重要的是,它将为您自己的表创建正确的SQL模式和tca配置,默认情况下还将包含pid字段。 It will store the UID of the page where the record is created. 它将存储创建记录的页面的UID。

If you don't want to begin your work from the scratch extension you can just carefully examine the created elements and copy/paste the things that you need to your current solution. 如果您不想从头开始扩展工作,则只需仔细检查创建的元素,然后将所需的内容复制/粘贴到当前解决方案中即可。

Although it's longer way there is no easier way to getting started with extension development. 尽管这是更长的方法,但是没有更容易的方法来进行扩展开发。

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

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