简体   繁体   中英

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. So I wish to create a new table 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. )

Finaly My Intention is to put parent_uid in the new table tx_adcontent . How do I do this with TCA , How do I configure in TCA. Otherwise I need to enter that parent_uid into a text field manualy, is there any automatic field inserting possible there? (I dont want to show that id in my backend edit form, but need to insert that automatically to db table( tx_adcontent ))

Thanks in advance.

Use the Extension Kickstarter for creating own extension which will allow you to

  • create new column in existing table
  • create new table for your records
  • create a new ContentType and some basic PHP class

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. It will store the UID of the page where the record is created.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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