سؤال

So,I need to make an extension in CMS,called TYPO3.Here some info about this extension:

"For a new TYPO3 6.1 website we need an extension (based on ExtBase / Fluid) for press releases,which should contain:

  • Headline / Description
  • Text
  • Up to 3 images (1 is required)
  • Thumbnail for list view
  • 1 PDF file
  • Release date

At the moment there is actually no design for a detail view, so there’s no link to detail view. So, for now, please concentrate on the frontend list view."

I have never worked with this CMS before,so I read about it and find out,that I need to use Extension Builder for creating this extension.So, I have downloaded and installed it and registered extension key for my extension on TYPO3 site.But when I tried to create this extension, I've found a lot of problems and questions.Some of them I've already solved,but some still unsolved.I've read tons of information about this extension in docs.typo3.org and still did not find answers.So,here this questions:

  1. Can I add all this fields just in one module or should I create for every field its own module?

  2. I know, that I need add frontend plugin for displaying this extension on a site and backend module for dispaying this extension in admin panel for editing opportunity.But I can not understand what exact plugin and what exact module should I add and where can I find it?I need to make my extension fully editable,of course,in backend and in frontend I need to have only result of what I add in backend,without any editing opportunities(in my case it should be headline,text,image,PDF file and date as I've written in the top of this question).So in the result I should be able adding,editing,deliting etc. this topics in admin panel and on the site I and all sites guests should be able just see it.

  3. In Extension Builder still does not implemented function for downloading files,so,as I understand,I need to add this opportunity to my extension by myself, but I do not know what exact code should I add and in what exact file.

  4. Also I have some problems with date format.When I try to add some date in date field I get this message:

The date "2014-02-01" was not recognized (for format "Y-m-d\TH:i:sP")

I tried to find some date format in extension files but I did not succeed.

I am junior php developer with 2 months experience of developing (and almost all time I've worked with HTML,CSS and Wordpress), so for me it is really hard to solve this problems by myself.I've spent already week on creation of this small extension and did not succeed,so your help,advises and answers to my questions will be very usefull for me :)

Thanks in advance and sorry for my bad English.

هل كانت مفيدة؟

المحلول

The first time that I read your post I was amazed , the second time I felt sorry and the third time I thought: 'this guy is so brave !' and that's when I decided to help you.

As you already will find out yourself: the Ext. builder only creates a 'framework' that you can use to add extra functionalities to your ext. The ext. builder creates an extension with extbase and fluid. So first thing is to learn how extabse and fluid works. Important to know is that extbase is the 'framework' for your code, fluid is template engine.

Extbase works with a oop approach, so read what Object Oriented Programming is about. Also Extbase uses Model / View / Controller (google it) and CRUD (create Read Update Delete) Knowing this, and then looking back at your ext, you will see that there are indeed classes defined by there purpose: - Classes / Controller - Classed / Domain / Model - Resources / private / templates (the view)

your model will define your 'data'. Each Object in your ext. will have its own model.

your first question: " Can I add all this fields just in one module or should I create for every field its own module? " Yes, all these 'fields' belong to the same model : the press release.

You will also need 1 controller that will handle all the request for your model: create a new press release, read (or list / show) it, update it or delete it. How the controller gets the data out of the database? using the what's called repository, can be read here : http://blog.typoplanet.de/2010/01/27/the-repository-and-query-object-of-extbase/

The controller will handle the data-flow: meaning that it is the controller that will give you all the press releases if you ask him, and send it to your view (the template) It will give you this information in an object. If your controller for example sends out: $pressreleases (will be done with for ex: $this->view->assign('pressreleases', $pressreleases); Try to add {pressreleases} in your list template and you will get a nice list of your pressrelease objects and there properties.

Once you understand this, you can get all the info out of your object and use it in your view using fluid. http://wiki.typo3.org/Fluid

With this, you normally would be able to understand a little on how extabse works, how it gets its data (model) how it retrieves it from the database (controller & repository) and how it shows it in the frontend (templates with fluid )

Your third question: If you know where your PDF is stored (normally in uploads/tx_yourextname/) and if you get the properties from your model in the template (remember debug) you will see that the pdf name is stored in the DB and provided as a property. For ex (if your object is called pressrelease in the show view) the you can retrieve the PDF name by using {pressrelease.pdf} in fluid. Putting this in an atag : src='uploads/tx_yourext/{pressrelease.pdf} ... will give you a download link.

4the: It says exactly what it says : you give a date formated as yyyy-mm-dd but it needs to be in format Y-m-d\TH:i:sP. Probably because your property 'release date' is of type DateTime, not Date This is a common problem, look in stackOverflow for the answer(s)

Last: Your (front-end) plugin is defined in your ext_localconf.php & ext_tables.php files Basically you can add multiple font end plugins in each TYPO3 plugin. but in your case, only 1 will be just enough: 1 that will handle the list and show requests.

So bon change my brave friend. I do hope you will understand a bit of what I have written and that you will find joy in using TYPO3 (just give it a month or 452, it is a steep but rewarding learning curve)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top