TYPO3 8.7 - TypoScript и разные наработки

08 september 2017, 22:56

TYPO3 пользуется бешеной популярностью в Европе (по моему мнению не заслужено) и в частности в Германии. Собой это творение инженерной мысли представляет фреймворк для корпоративных сайтов. По работе пришлось погрузиться в его недры. Многое кажется до абсурда перекручено, движок очень не поворотливый, каждое действие требует частого обновления кэша, которое длится в течении минуты. А сам TypoScript отбивает всё желание что-то творить. Тем не менее пока работы с Laravel и MODX в Германии я не нашёл приходится разбираться и погружаться в дебри. Хочется заметить, что документация там очень скудная, поиск какой-либо информации на русском датирована аж 2011ого года. Это самое свежее что я находил. Видимо русскоязычное сообщество отмело TYPO3 за необоснованную сложность работы. На этом лирическое отступление хочу закончить. Как-нибудь сяду и с нуля попробую создать простенький сайтик, показав как это не просто. Хотя на практике в одной довольно известной (в узких кругах) веб-студии, делал вот такую вот поделку. Что примечательно, систему ЧПУ написал русский программист =)

Здесь будет свалка всего того, что мне в последствии пригодится при дальнейшей работе с этим движком, наверное самая ценная часть из этого, так это сам TypoScript (основа основ). Plugins После установки ke_ search News Из папки с плагином, который находится по адресу: /html/typo3/typo3conf/ext/news/Resources/Private перенести нужные папки в папку /fileadmin/templates/ext/news/ и затем добавить в файл constants.ts пути по умолчанию

plugin.tx_news.view.templateRootPath = fileadmin/templates/news/Templates
plugin.tx_news.view.partialRootPath = fileadmin/templates/ext/news/Partials
plugin.tx_news.view.layoutRootPath = fileadmin/templates/ext/news/Layouts
Debug mode
{newsItem}
Default setup.ts (TypoScript)

config.simulateStaticDocuments = 0
    config.baseURL = http://typo3.p392460.webspaceconfig.de/
    config.tx_realurl_enable = 1

    page = PAGE
    page {
        typeNum = 0
        config.doctype = html5
        meta.author.field = author
        meta.description.field = description
        meta.viewport = width=device-width, initial-scale=1

        includeCSS {
            f1 = fileadmin/templates/main/css/bootstrap.min.css
            f2 = fileadmin/templates/main/css/font-awesome.min.css
            f3 = fileadmin/templates/main/css/style.css
            f4 = https://fonts.googleapis.com/css?family=Open+Sans:400,700
        }

        includeJS {
            f1 = fileadmin/templates/main/js/jquery.min.js
            f2 = fileadmin/templates/main/js/bootstrap.min.js
            f3 = fileadmin/templates/main/js/main.js
        }

        10 = FLUIDTEMPLATE
        10{
            file = fileadmin/templates/main/index.html
            variables.mainmenu = HMENU
            variables.mainmenu {
                wrap=|
                special = directory
                special.value = 6
                1 = TMENU
                1 {
                    wrap =</code></pre><br>
|<br>
<pre class="prettyprint"><code>
                    expAll = 1

                    NO {
                        stdWrap.cObject = TEXT
                        stdWrap.cObject {
                            value.field = title
                            stdWrap.wrap = |
                        }
                        stdWrap.postCObject = TEXT 
                        stdWrap.postCObject.field = subtitle 

                        ATagParams = class="class" alt="{field:subtitle}" title="{field:title}"
                        ATagParams.insertData = 1
                        wrapItemAndSub =</code></pre><br>
|<br>
<pre class="prettyprint"><code>
                    }

                    CUR < .NO
                    CUR = 1
                    CUR {
                        wrapItemAndSub =</code></pre><br>
|<br>
<pre class="prettyprint"><code>
                        stdWrap.postCObject >
                    }

                    ACT < .NO
                    ACT = 1
                    ACT {
                        wrapItemAndSub =</code></pre><br>
|<br>
<pre class="prettyprint"><code>
                        stdWrap.postCObject >
                    }
                }

                2 < .1
                2 {
                    wrap =</code></pre><br>
<ul>|</ul><pre class="prettyprint"><code>
                    NO {
                        wrapItemAndSub =</code></pre><br>
<ul><li><pre class="prettyprint"><code>|</code></pre></li></ul><pre class="prettyprint"><code>
                        stdWrap.postCObject >
                    }

                    CUR {
                        wrapItemAndSub =</code></pre><br>
<ul><li>|</li></ul><pre class="prettyprint"><code>
                    }

                    ACT {
                        wrapItemAndSub =</code></pre><br>
<ul><li>|</li></ul><pre class="prettyprint"><code>
                    }
                }
            }

            variables.secondmenu < .variables.mainmenu
            variables.secondmenu {
                1 {
                    NO {
                        stdWrap.postCObject >
                    }
                }
            }

            variables.footermenu = HMENU
            variables.footermenu {
                special = directory
                special.value = 12
                1 = TMENU
                1 {
                    wrap =</code></pre><br>
 <br>
<ul>|</ul><pre class="prettyprint"><code>
                    expAll = 0
                    NO.allWrap =</code></pre><br>
<ul><li><pre class="prettyprint"><code>|</code></pre></li></ul><pre class="prettyprint"><code>
                    RO < .NO
                    RO = 0
                    linkWrap = |
                    CUR < .NO
                    CUR = 0
                    CUR.allWrap =</code></pre><br>
<ul><li>|</li></ul><pre class="prettyprint"><code>
                    ACT < .CUR
                }
            }

            variables.products = HMENU
            variables.products {
                special = directory
                special.value = 8
                1 = TMENU
                1 {
                    wrap =</code></pre><br>
 <br>
<ul>|</ul><pre class="prettyprint"><code>
                    expAll = 0
                    NO.allWrap =</code></pre><br>
<ul><li><pre class="prettyprint"><code>|</code></pre></li></ul><pre class="prettyprint"><code>
                    RO < .NO
                    RO = 0
                    linkWrap = |
                    CUR < .NO
                    CUR = 0
                    CUR.allWrap =</code></pre><br>
<ul><li>|</li></ul><pre class="prettyprint"><code>
                    ACT < .CUR
                }
            }
            variables.maincontent = CONTENT
            variables.maincontent < styles.content.get
            variables.maincontent {
                table = tt_content
                select {
                    where = colPos = 0
                    orderBy = sorting
                    languageField = sys_language_uid
                }
            }

            variables.rightside = CONTENT
            variables.rightside < styles.content.get
            variables.rightside {
                table = tt_content
                select {
                    where = colPos = 1
                    orderBy = sorting
                    languageField = sys_language_uid
                }
            }

            variables.search = CONTENT
            variables.search < styles.content.get
            variables.search {
                colPos = 0
            }
        }
    }
    lib.searchbox_plugin = COA_INT
    lib.searchbox_plugin {
        10 < plugin.tx_kesearch_pi1

        10.resultPage = 15
        10.cssFile = EXT:ke_search/res/ke_search_pi1.css
        10.loadFlexformsFromOtherCE = 24
    }
    lib.searchbox_html.searchbox = COA
    lib.searchbox_html.searchbox {
        10.loadFlexformsFromOtherCE = 29
        10 = LOAD_REGISTER
        10 {
            url.cObject = TEXT
            url.cObject {
                typolink.parameter = 29
                typolink.returnLast = url
            }
        }
        20 = TEXT
        20 {
            value (</code></pre><br>
 <br>
/> /><br>
<pre class="prettyprint"><code>
            )
            insertData = 1
        }
    }

    lib.header = TEXT
    lib.header {
        data = page:title
        override {
            data = page:title
            if.isTrue.data = page:title
        }
    }

    lib.products = COA
    lib.products {
        10 = HMENU
        10 {
            special = directory
            special.data = TSFE:id

            1 = TMENU
            1 {
                NO {
                    stdWrap.cObject = COA
                    stdWrap.cObject {
                        10 = TEXT
                        10 {
                            field = title
                            wrap = <span class="headline">|</span>
                        }

                        20 = FILES
                        20 {
                            references {
                                table = pages
                                uid.data = uid
                                fieldName = media
                            }
                            renderObj = IMAGE
                            renderObj.file.import.data = file:current:publicUrl
                        }
                    }

                    wrapItemAndSub =</code></pre><br>
<ul><li><pre class="prettyprint"><code>|</code></pre></li></ul><pre class="prettyprint"><code>
                }
            }

            wrap =</code></pre><br>
 <br>
<ul>|</ul><pre class="prettyprint"><code>
        }
    }

    lib.breadcrumb=COA
    lib.breadcrumb {
        10 = TEXT
        10 {
            typolink.parameter = 1
            wrap =</code></pre><br>
<ul><li><pre class="prettyprint"><code>|</code></pre></li></ul><pre class="prettyprint"><code>
        }

        20 = HMENU
        20 {
            special = rootline
            special.range = 0|-1
            1 = TMENU
            1.noBlur = 1
            1.target = _self
            1.NO {
                stdWrap.field = title
                ATagTitle.field = nav_title // title
                allWrap =</code></pre><br>
<ul><li>|</li></ul><pre class="prettyprint"><code>
            }
            1.CUR = 1
            1.CUR {
                stdWrap.field = title
                doNotLinkIt = 1
                allWrap =</code></pre><br>
<ul><li>|</li></ul><pre class="prettyprint"><code>
            }
        }

        wrap =</code></pre><br>
 <br>
<ul>|</ul><pre class="prettyprint">
    }

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

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

    plugin.tx_kesearch_pi1.templateRootPaths.2 = {$plugin.tx_kesearch.view.templateRootPath}
    plugin.tx_kesearch_pi1.partialRootPaths.2 = {$plugin.tx_kesearch.view.partialRootPath}
    plugin.tx_kesearch_pi1.layoutRootPaths.2 = {$plugin.tx_kesearch.view.layoutRootPath}

    plugin.tx_kesearch_pi2.templateRootPaths.2 = {$plugin.tx_kesearch.view.templateRootPath}
    plugin.tx_kesearch_pi2.partialRootPaths.2 = {$plugin.tx_kesearch.view.partialRootPath}
    plugin.tx_kesearch_pi2.layoutRootPaths.2 = {$plugin.tx_kesearch.view.layoutRootPath}

    plugin.tx_kesearch_pi3.templateRootPaths.2 = {$plugin.tx_kesearch.view.templateRootPath}
    plugin.tx_kesearch_pi3.partialRootPaths.2 = {$plugin.tx_kesearch.view.partialRootPath}
    plugin.tx_kesearch_pi3.layoutRootPaths.2 = {$plugin.tx_kesearch.view.layoutRootPath}</pre> <strong><u>second.ts</u></strong> <pre class="prettyprint">page {
        10.file = fileadmin/templates/main/second.html
    }</pre> <strong><u>constants.ts</u></strong> <pre class="prettyprint">domain = http://typo3.p392460.webspaceconfig.de/
PathToFiles = fileadmin/templates/

plugin.tx_news.view.templateRootPath = fileadmin/templates/ext/news/Templates
plugin.tx_news.view.partialRootPath = fileadmin/templates/ext/news/Partials
plugin.tx_news.view.layoutRootPath = fileadmin/templates/ext/news/Layouts

plugin.tx_kesearch.view.templateRootPath = fileadmin/templates/ext/ke_search/Templates
plugin.tx_kesearch.view.partialRootPath = fileadmin/templates/ext/ke_search/Partials
plugin.tx_kesearch.view.layoutRootPath = fileadmin/templates/ext/ke_search/Layouts

Первичные настройки Template->Home->Neue Template Konstanten: Setup: Objekte in Backend В глобальный шаблон от Home нужно добавить используемый объект: Liste -> main (Template) -> Enthält von Verfügbare Objekte in Ausgewählte Objekte tsref

MODX.ONE
0    2850    0
+1

Comments ()

    You need to login to create comments.