extensions

Get File Relation

//Here is a small snippet I use to get uploaded images from a content object (tt_content).

public function getContentImages($tt_content_uid) {
    /** @var \TYPO3\CMS\Core\Resource\FileRepository $fileRepository */
    $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Resource\FileRepository');
    $fileObjects = $fileRepository->findByRelation('tt_content', 'image', $tt_content_uid);

    // Get file information
    $files = array();
    foreach ($fileObjects as $key => $value) {
        $file = array();
        $file['reference'] = $value->getReferenceProperties();
        $file['original'] = $value->getOriginalFile()->getProperties();
        $files[] = $file;
    }

    return $files;
}

How I can render Content Object from tt_content

In Extbase extensions $this->cObj is no more available in the current scope, so you need to get it firts before you can use:
In controller

/**
     * @param $pageUid
     * @param int $colPos
     * @return string
     */
    private function getTTContent($pageUid, $colPos = 0)
    {
        $contentObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
        $conf['table'] = 'tt_content';
        $conf['select.'] = array(
            'pidInList' => $pageUid,
            'where' => 'colPos=' . $colPos
        );
        return $contentObj->cObjGetSingle('CONTENT', $conf);
        /*$tt_contents = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'tt_content', 'deleted=0 and hidden=0 and pid=' . $pageUid . ' and colPos=' . $colPos . ' and sys_language_uid=' . $GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid'], '', 'sorting asc');
        if (!empty($tt_contents)) {
            $contentObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
            foreach ($tt_contents as $tt_content) {
                $conf['tables'] = 'tt_content';
                $conf['source'] = $tt_content['uid'];
                $tempContent .= $contentObj->cObjGetSingle('RECORDS', $conf);
            }
        }
        return $tempContent;*/
    }

 

$cObj = $this->configurationManager->getContentObject();
$ttContentConfig = array(
    'tables'       => 'tt_content',
    'source'       => 123,
    'dontCheckPid' => 1
);
$content .= $cObj->RECORDS($ttContentConfig);

In model.

/*
	 * get TT content
	 */
	public function getTTcontent($uids){
		$content = '';
		$tempArray = explode(",", $uids);
		$cObj = $GLOBALS['TSFE']->cObj;
		foreach($tempArray as $uid){
			$ttContentConfig = array(
				'tables'       => 'tt_content',
				'source'       => $uid,
				'dontCheckPid' => 1
			);
			$content .= $cObj->RECORDS($ttContentConfig);
		}
		return $content;
	}

lib.footer.social = RECORDS
lib.footer.social {
    source = 140
    dontCheckPid = 1
    tables = tt_content
}

 


How to use the Fluid Standalone view to render template based emails

$this->view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('donate') . 'Resources/Private/Templates/Donors/List_backend.html');

This feature is part of Extbase 1.3, included in TYPO3 4.5 LTS.

Find the Code for TYPO3 version >= 6.0 below

Add the following function to your controller (or preferably to a common abstract base controller).
(continue reading…)


Record tree for TCA

Extension Key: cps_tcatree required plugin: Developer library ( cps_devlib )

Installation / Quick start

Changes in ext_tables.php

For each table you want to display as a tree you have to define a new key “treeParentField” which defines the field in which the relation is stored. This field can be either a comma separated list of uids or a mm-relation field.
(continue reading…)


TYPO3 Services

With a services extension you can extend the functionality of TYPO3 (or an extension which uses services), without any changes to the original code of TYPO3 or the extension.

Services are PHP classes inside of an extension similar to FE-plugins. Usually when you use a class, you address it directly by creating an instance: (continue reading…)


headerComment2

typo3项目中遇到需要在baseurl之前输出内容的情况,写了一个插件实现.

用法: TS中配置

config.headerComment2 = <!– abcdefg –>

下载

1 Comment more...


Error 404 multilingual

error_404_multilingual shows the defined error page of the given language if the requested page or file could not be found

Why this extension?

The Extension was build because the existing 404 handling extensions does not work fine on sites with more than one language. (continue reading…)


Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress