How to extend news with extra field in typo3


Many time we need to extend news with some text fields or any other table relation.

We can directly in news extension. better we can extend through other extension.

For that first we need to create that fields in news table.

So following SQL you need to extend in your extension [ in ext_tables.sql file ]

CREATE TABLE tx_news_domain_model_news (
    category int(11) unsigned DEFAULT '0',
);

than after you need to add following code in ext_tables.php. this extended category will display before bodytext area.

$extendCategory = array(
    'category' => array (
        'exclude' => 0,
        'l10n_mode' => 'noCopy',
        'label' => 'Sponsors',
        'config' => array(
            'type' => 'select',
            'items' => array (
                array('',0),
            ),
            'renderType' => 'selectSingle',
            'foreign_table' => 'tx_jsfaq_domain_model_category',
            'minitems' => 0,
            'maxitems' => 1,
        ),
    ),
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
    'tx_news_domain_model_news',
    $extendCategory,
    1
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
    'tx_news_domain_model_news',
    'paletteArchive', '--linebreak--,category','after:bodytext'
);

If you have any query then feel free to contact me at Jainish Senjaliya

How do i skip controller and action for custom extension in typo3


This is really necessary to remove extra parameter for SEO purpose

Following script will help you more. you need to set this typoscript in your setup file

config.tx_jsfaq.features.skipDefaultArguments = 1
plugin.tx_jsfaq.features.skipDefaultArguments = 1

Note : tx_jsfaq

This is the extension name. you have to use your extension name

After applying this controller and action will be removed from url

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How do i skip controller and action for tt_news in typo3


This is really necessary to remove extra parameter for SEO purpose

Following script will help you more. you need to set this typoscript in your setup file.

plugin.tx_news {
    settings {
        link {
            skipControllerAndAction = 1
        }
    }
}

After applying this controller and action will be removed from url

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to set Customize page title in news detail of typo3 + typoscript


 

How to set Customize page title in news detail of typo3 + typoscript

First of all we have to remove by default title tag.

Below script will remove title tag from source

config.noPageTitle = 2

After hiding of main title we can set news title as page title

Following script will help you for display page title.

This is only work when we have page id 72

[globalVar = TSFE:id = 72]

 newsTitle=COA
 newsTitle {
    5 = RECORDS
    5 {
        source = {GPvar:tx_ttnews|tt_news|tx_ttnews[tt_news]}
        source.insertData = 1
        tables = tt_news
        conf.tt_news >
        conf.tt_news = TEXT
        conf.tt_news.field=title
        wrap = <title>|</title>
    }
 }
page.headerData.5 < newsTitle

we can set condition based upon get parameter

[globalVar = _GET|tx_news_pi1|news > 0]

  config.noPageTitle = 2

  temp.newsTitle = RECORDS
  temp.newsTitle {
    dontCheckPid = 1
      tables = tx_news_domain_model_news
      source.data = GP:tx_news_pi1|news
      source.intval = 1
      conf.tx_news_domain_model_news = TEXT
      conf.tx_news_domain_model_news {
        field = title
        htmlSpecialChars = 1
      }
      wrap = |
  }
  page.headerData.1 >
  page.headerData.1 < temp.newsTitle

[global]

i hope it will work for you. πŸ™‚

it will be good for SEO purpose

If you have any query then feel free to contact me at Jainish Senjaliya