[TYPO3-german] News um eigene Felder erweitern (tx_news)
Bernhard Prange
mail at bernhard-prange.de
Thu Dec 19 18:10:24 CET 2013
Ich wollte das Thema hier nochmal ankurbeln... kann mir jemand sagen,
was ich falsch mache? ... ich bekomme {newsItem.meinfeldname} einfach
nicht zum Laufen...
Am 19.12.2013 10:02, schrieb Bernhard Prange:
> Hallo Liste,
> ich möchte tx_news um 4 Felder erweitern. Diese sollen spätzer im FE
> ausgegeben werden.
> Ich bin beim Aufbau meiner eigenen Extension dieser Anleitung gefolgt:
> http://docs.typo3.org/typo3cms/extensions/news/Main/Tutorial/ExtendingNews/Index.html
>
> * Flexform Felder wurden angelegt
> * Felder sind in der Datenbank vorhanden
> * Felder sind beschreibbar
>
> Leider lassen sich die Felder nicht mittels {newsItem.meinfeldname}
> aufrufen. Was mache ich falsch?
>
> Inhalt der Extension:
>
> ext.tables.sql
>
> #
> # Table structure for table 'tx_news_domain_model_news'
> #
> CREATE TABLE tx_news_domain_model_news (
>
> year int(11) DEFAULT '0' NOT NULL,
> volume int(11) DEFAULT '0' NOT NULL,
> issue varchar(255) DEFAULT '' NOT NULL
> pages varchar(255) DEFAULT '' NOT NULL,
>
> );
>
> ext.tables.php
>
> <?php
> if (!defined('TYPO3_MODE')) {
> die ('Access denied.');
> }
> $tempColumns = array(
> 'issue' => array(
> 'exclude' => 0,
> 'label' => 'Issue',
> 'config' => array(
> 'type' => 'input',
> 'size' => '30',
> )
> ),
> 'volume' => array(
> 'exclude' => 0,
> 'label' => 'Volume',
> 'config' => array(
> 'type' => 'input',
> 'size' => '30',
> )
> ),
> 'year' => array(
> 'exclude' => 0,
> 'label' => 'Year',
> 'config' => array(
> 'type' => 'input',
> 'size' => '30',
> )
> ),
> 'pages' => array(
> 'exclude' => 0,
> 'label' => 'Pages',
> 'config' => array(
> 'type' => 'input',
> 'size' => '30',
> )
> ),
> );
>
> t3lib_div::loadTCA('tx_news_domain_model_news');
> t3lib_extMgm::addTCAcolumns('tx_news_domain_model_news',$tempColumns,1);
> t3lib_extMgm::addToAllTCAtypes('tx_news_domain_model_news','issue;;;;1-1-1,
> volume, year, pages');
> ?>
>
> Rescources/Private/extend-news.txt
>
> Domain/Model/News
>
> Configuration/TypoScript/setup.txt
>
> plugin.tx_news {
> persistence {
> classes {
> Tx_News_Domain_Model_News {
> subclasses {
> # hier wichtig: index 0
> überschreiben für die
> # normale News-Ansicht
> # 0 == Typ-Auswahl an
> News-Datensatz
> 0 =
> Tx_TorrNewsExt_Domain_Model_NewsDefault
> }
> }
> Tx_TorrNewsExt_Domain_Model_NewsDefault {
> mapping {
> recordType = 0
> tableName =
> tx_news_domain_model_news
> }
> }
> }
> }
> }
>
> Configuration/TypoScript/constants.txt
>
> plugin.tx_news {
> view {
> templateRootPath =
> EXT:wp_custom_news/Resources/Private/Templates/
> partialRootPath =
> EXT:wp_custom_news/Resources/Private/Partials/
> layoutRootPath =
> EXT:wp_custom_news/Resources/Private/Layout/
> }
> }
>
>
> Classes/Domain/Model/CustomNews.php
>
> <?php
> namespace TYPO3\WpCustomNews\Domain\Model;
>
> /***************************************************************
> * Copyright notice
> *
> * (c) 2013
> * All rights reserved
> *
> * This script is part of the TYPO3 project. The TYPO3 project is
> * free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> * the Free Software Foundation; either version 3 of the License, or
> * (at your option) any later version.
> *
> * The GNU General Public License can be found at
> * http://www.gnu.org/copyleft/gpl.html.
> *
> * This script is distributed in the hope that it will be useful,
> * but WITHOUT ANY WARRANTY; without even the implied warranty of
> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> * GNU General Public License for more details.
> *
> * This copyright notice MUST APPEAR in all copies of the script!
> ***************************************************************/
>
> /**
> *
> *
> * @package wp_custom_news
> * @license http://www.gnu.org/licenses/gpl.html GNU General Public
> License, version 3 or later
> *
> */
> class CustomNews extends tx_news_domain_model_news {
>
> /**
> * year
> *
> * @var \integer
> */
> protected $year;
>
> /**
> * volume
> *
> * @var \integer
> */
> protected $volume;
>
> /**
> * issue
> *
> * @var \integer
> */
> protected $issue;
>
> /**
> * pages
> *
> * @var \string
> */
> protected $pages;
>
> /**
> * Returns the year
> *
> * @return \integer $year
> */
> public function getYear() {
> return $this->year;
> }
>
> /**
> * Sets the year
> *
> * @param \integer $year
> * @return void
> */
> public function setYear($year) {
> $this->year = $year;
> }
>
> /**
> * Returns the volume
> *
> * @return \integer $volume
> */
> public function getVolume() {
> return $this->volume;
> }
>
> /**
> * Sets the volume
> *
> * @param \integer $volume
> * @return void
> */
> public function setVolume($volume) {
> $this->volume = $volume;
> }
>
> /**
> * Returns the issue
> *
> * @return \integer $issue
> */
> public function getIssue() {
> return $this->issue;
> }
>
> /**
> * Sets the issue
> *
> * @param \integer $issue
> * @return void
> */
> public function setIssue($issue) {
> $this->issue = $issue;
> }
>
> /**
> * Returns the pages
> *
> * @return \string $pages
> */
> public function getPages() {
> return $this->pages;
> }
>
> /**
> * Sets the pages
> *
> * @param \string $pages
> * @return void
> */
> public function setPages($pages) {
> $this->pages = $pages;
> }
>
> }
> ?>
>
> Vielen Dank für die Hilfe!
>
>
> Gruß
>
> Ben
>
>
>
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>
More information about the TYPO3-german
mailing list