TYPO3 – TypoScript auto-complete in backend

断了今生、忘了曾经 提交于 2019-12-24 01:32:47

问题


It's just a simple question but couldn't find any helpful solution or hints...I have the current TYPO3 version and watched some videos on YouTube about it and wondered why I have no autocomplete when writing some TypoScript.

I saw it in this video: https://www.youtube.com/watch?v=ZCSIK3lFfwM&list=PL1D69sw7eWECaiqIOLhcSnjgTTjLJdd4I&index=5 at 03:45

Is it possible to do it in the newest version or do I have to use an IDE?


回答1:


First install the extension ts3editor. Then you can "activate" auto complete just by pressing CTRL+SPACE. For example, write:

->config. then press ->"CTRL+SPACE" then the autocomplete advice/suggestion will pop-up.

I use version 9 and it works fine.




回答2:



The TYPO3 core offers the extension "t3editor", which is based on CodeMirror and provides syntax highlighting and codecompletion.

I suspect it just isn't activated in your TYPO3 instance. You can check this in the Extension Manager in your TYPO3 backend.


1st edit: As the extension seems to be working in general – please try writing config. on a new line in your editor. The Top Level Objects (e.g. config) aren't auto-completed in the backend, but it should open a box with suggested configurations after you wrote the dot.

t3editor has some restrictions: Nesting isn't supported (see example below). I read it can have problems inside conditions, too.

// This is auto-completed:
config.no_cache = 1

// This isn't:
config {
  no_cache = 1
}

In short: t3editor can only help you to a certain degree. It is considered best practice to save all TypoScript (and everything else related to templating) in files into a dedicated templating extension (or sitepackage) and use an IDE. There are TypoScript auto-complete plugins for several editors and IDEs, for example PhpStorm.


If you want more information about using sitepackages, see this video series on YouTube by the offical TYPO3 account, or take a look at my personal templating extension which I use for new websites.


2nd edit: After you wrote you're using the Sprint Release 9.1.0, I was able to test the behaviour in this version and can confirm that code completion won't work in it.

Actually, that seems to be the intended future behaviour of t3editor for the TYPO3 core team. They want to remove this extension in TYPO3 v10 altogether (it's planned to be available on GitHub then). The reason is that they don't recommend to use/save TypoScript directly in the database, but in a separate template extension (see explanation above).

Sources:

  • TYPO3 Bug tracker, issue #81885
  • Communication platform TYPO3 Slack, Channel #typo3-cms-coredev, Nov 19th, 2017

So again, I recommend to use an API instead.



来源:https://stackoverflow.com/questions/49307684/typo3-typoscript-auto-complete-in-backend

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!