typoscript

Typo3 Head, Body Tag extend

page.headTag.stdWrap.cObject = COA
page.headTag.stdWrap.cObject{
    5 = TEXT
    5.value = <head>
    10 = TEXT
    10.value(
xxxx
    )
}
page.bodyTagCObject = COA
page.bodyTagCObject{
    5 = TEXT
    5.value = <body>
    10 = TEXT
    10.value(
xxxx
    )
}

 


typo3后台禁止关联删除

TCA Config:

'behaviour' => array(
    'enableCascadingDelete' => false
),

Extbase – how to call controller action via Typoscript directly

If you have an extbase extension and you need to call a controller action via TypoScript, things have changed from TYPO3 4.7 to 6.1. TYPO3 6 has a lot of code rewritten, depends heavily on PHP namespaces and extbase extensions from earlier versions will no longer work.
To get started with all the necessary bootstrap code for a new extension, use the extension “extension_builder” from TER.

Let’s assume we have a little extension and we want to assign the result of a direct call of a controller action to a TS object.
Our controller code looks like this:

namespace MyVendorName\MyExtName\Controller;
class MyModelController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {

public function myTestAction() {
return “some string”;
}

Please notice the namespace, this is very important! Your ext_localconf.php should look something like this:


\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
‘MyVendorName.’ . $_EXTKEY,
‘Pi1’,
array(
‘MyModel’ => ‘myTest’,
),
// non-cacheable actions
array(

)
);

‘Pi1’ is simply the name of the frontend plugin

TypoScript config

Now we set up a TS-object which should hold the output of our “myTestAction” method.

lib.myObj = USER
lib.myObj = 10
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Pi1
extensionName = MyExtName
controller = MyModel
vendorName = MyVendorName
action = myTest
switchableControllerActions {
MyModel {
1 = myTest
}
}

settings =< plugin.tx_myextname.settings persistence =< plugin.tx_myextname.persistence view =< plugin.tx_myextname.view update =< plugin.tx_myextname.update } The parameter “vendorName” is new and very important – it won’t work without it. Take care of the camel case notation too – the whole extbase framework is based on this case-sensitive coding convention. Now we are done – our controller action is directly called via TypoScript.


extbase update TS Setup

//site domain
        $baseURL = '';
        $templateData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_template', 'uid=1');
        $templateService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
        $templateService->ext_regObjectPositions($templateData['constants']);
        if(GeneralUtility::_GP('domain')){
            $urlInfo = parse_url(GeneralUtility::_GP('domain'));
            if(!isset($urlInfo['scheme'])){
                $baseURL = 'http://'.$urlInfo['path'].'/';
            }else{
                $baseURL = $urlInfo['scheme'].'://'.$urlInfo['host'].'/';
            }
        }
        $templateService->ext_putValueInConf('config.baseURL', $baseURL);
        // Set the data to be saved
        $recData = array();
        $recData['sys_template'][1]['constants'] = implode($templateService->raw, LF);
        // Create new  tce-object
        $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
        $tce->stripslashes_values = FALSE;
        $tce->start($recData, array());
        $tce->process_datamap();
        // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
        $tce->clear_cacheCmd('all');

TS Data

getText ist wohl die mächtigste Funktion, um mal eben von wo auch immer ein paar Daten herzuzaubern. Im Content-Objekt selbst heißt die Funktion getData. Schaut selbst welche Möglichkeiten angeboten werden.

Die Eigenschaft getText besteht aus mehreren Parametern. Der erste Parameter wird mit einem Doppelpunkt von allen anderen Parametern getrennt. Alle weiteren Parameter werden mit Hilfe der | Pipe unterteilt. (continue reading…)


TS lightbox 配置

config {
  disableAllHeaderCode = 1
  #additionalHeaders = Content-type:application/json
  xhtml_cleaning = 0
  admPanel = 0
  debug = 0
  no_cache = 1
}
page.includeJS>
page.includeCSS>
page.includeJSFooterlibs>

TS取FAL Files

TS取FAL Files

        40 =  FILES
        40 {
          references {
            table = tt_content
            #uid.data = uid
            fieldName = image
          }
          #renderObj = TEXT
          #renderObj {
          #  data = file:current:publicUrl
          #  wrap = 
#} renderObj = IMAGE renderObj { file.import.data = file:current:publicUrl file.height = 103 wrap = |
stdWrap.typolink.parameter.data = field:header_link } }

TYPO3 Ajax Page Configuration

ajax = PAGE
ajax {
  typeNum = 1234

  10 < plugin.myextension_pi1     

  config {
    disableAllHeaderCode = 1
    additionalHeaders = Content-type:application/json
    xhtml_cleaning = 0
    admPanel = 0
    debug = 0
    no_cache = 1
  }
}

TS查表

ts_bcn.20 = CONTENT
ts_bcn.20{
    table = tx_extpackage_data
    select.pidInList = 0
    select.uidInList.data = GP:uid
    renderObj = COA_INT
    renderObj {
       10 = TEXT
       10.field = package_id
       20 = TEXT
       20.field = consignee_lastname
       20.wrap = , |
       30 = TEXT
       30.field = consignee_firstname
    }
    wrap = 

|

}
lib.randomArticles = CONTENT
lib.randomArticles {
	wrap = 
|
table = tx_articledatabase_articles select { pidInList = 97 orderBy = rand() max = 3 } renderObj > renderObj = COA_INT renderObj { 10 = TEXT 10.field = title 10.wrap =

|

20 = TEXT 20.field = description 20.wrap=

|

20.typolink.parameter = 97 20.typolink.additionalParams.field=uid 20.typolink.additionalParams.wrap = &tx_articledatabase_pi1[showUid]=| 20.crop = 150|...|1 } }
10 = CONTENT
10 {
    table = pages
    select.pidInList = 5
    renderObj = COA
    renderObj {
        10 = TEXT
        10.field = title
        20 = TEXT
        20.data = COBJ:parentRecordNumber
    }
}

link 忽略access

config.typolinkLinkAccessRestrictedPages = NONE

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