TYPO3 insert plugin on every pages - typo3

I have TYPO3 version 7.6.18. I want to insert some plugin in every pages, I think it may be do with typoscript? Help me please, how to do it ?

If you want to insert a specific plugin on every page, you can simply add it to your page like so:
page = PAGE
page{
10 = FLUIDTEMPLATE
10{
# the fluid template settings
}
# add a fixed plugin to be rendered after the normal fluid template
20 = USER
20{
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = MyExt
vendorName = MyVendor
pluginName = Pi1
switchableControllerActions{
TheController{
0 = actionName
}
}
}
}
This basically adds a new section to your page rendering that only renders your plugin.

You could also load the plugin into lib and render it in your FLUID template.
TypoScript
lib.myPlugin = USER
lib.myPlugin {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = MyExt
vendorName = MyVendor
pluginName = Pi1
switchableControllerActions{
TheController{
0 = actionName
}
}
}
FLUID template
<f:cObject typoscriptObjectPath="lib.myPlugin"/>

Related

TYPO3. Add new page type with typeNum to TypoScript

I have this error in my extension:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #129458537: The page is not configured! [type=100][]. This means that there is no TypoScript object of type PAGE with typeNum=102 configured
So I want to add a new typeNum = 100 to the TypoScript, with a message to display in the FE, but dunno how!
You can simply define new typeNums in TypoScript like this:
page = PAGE
page.typeNum = 0
page {
# set properties ...
}
msg = PAGE
msg.typeNum = 100
msg {
10 = TEXT
10.value = My special message.
}
See: https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Setup/Page/Index.html
The common site-setup looks like this:
page = PAGE
page {
typeNum = 0
[FURTHER SETUP]
}
any alternative page needs another name and another typeNum:
altPage = PAGE
altPage {
typeNum = 100
[FURTHER SETUP]
}
altPage2 = PAGE
altPage2 {
typeNum = 102
[FURTHER SETUP]
}
The FURTHER SETUP must include some kind of template to show:
altPage2 = PAGE
altPage2 {
typeNum = 102
10 = FLUIDTEMPLATE
10 {
...
}
}
LINKS to documentation:
TypoScript Page
TypoScript Template
TypoScript FluidTemplate
Let me know in the comments if it's sufficient for you. Else I can add a bit more description, links or TypoScript.

How can I get a rootline / breadcrumb within an Extbase Frontent Plugin in TYPO3

Is there a way to work with dataProcessing / MenuProcessor within an Extbase Frontend Plugin in TYPO3 9?
I want to build a page rootline within a plugin. I know how to make it in page context or in a tt-content element but can I get it in a plugin too?
I tried the following in my plugin setup, but this does not work:
plugin.tx_extensions_show {
view {
...
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = rootline
special.range = 1|-1
includeNotInMenu = 1
as = rootline
}
}
}
}
Inside your plugin code you can fetch the rootline in an array:
// ($MP and $this->context are optional)
$rootline = GeneralUtility::makeInstance(RootlineUtility::class, $uid, $MP, $this->context);
$rootlinePages = $rootline->get();
Now you can pass $rootlinePages on to your FLUID template.
Hth.
Based on the hint of Loek to do it in the controller an not in the fluid template I found my own solution to fetch the rootline in an array and pass it to my Fluid template for TYPO3 9:
$rootLineUtility = new \TYPO3\CMS\Core\Utility\RootlineUtility($GLOBALS['TSFE']->id);
$rootline = $rootLineUtility->get();
$this->view->assign('rootline', $rootline);

how can i hide the read more links in typo3 (7.6.23) using tx_news (6.1.1)

I need to hide the more link in the news_list when cropMaxCharacters exceed the maximum characters in a news.
Is it possible via typoscript template setup?
This is my typoscript template for the news page.
plugin.tx_news.settings {
startingpoint = 128
list.paginate.itemsPerPage = 10
cropMaxCharacters = 9999
}
lib.news = USER
lib.news {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Pi1
vendorName = GeorgRinger
extensionName = News
controller = News
settings =< plugin.tx_news.settings
persistence =< plugin.tx_news.persistence
view =< plugin.tx_news.view
}
lib.news_list < lib.news
lib.news_list {
action = list
switchableControllerActions.News.1 = list
}
lib.news_detail < lib.news
lib.news_detail {
action = detail
switchableControllerActions.News.1 = detail
}
[globalVar = GP:tx_news_pi1|news > 0]
page.100.10.20 = COA
page.100.10.20.10 < lib.news_detail
[else]
page.100.10.20 = COA
page.100.10.20.10 < lib.news_list
[end]
cropMaxCharacters is set that heigh, because i want to have all news with their complete text.
If there is a way to show all news on one page in detailed view i'd be interested in that, too.
Your wishes can come true. but not so much with typoscript but with fluid.
As other extensions ext:news uses fluid templates which can be selectively(!) been replaced.
First add your pathes to the rootpathes:
plugin.tx_news {
view {
layoutRootPaths.10 = EXT:site_ext/Resources/Private/news/Layouts
partialRootPaths.10 = EXT:site_ext/Resources/Private/news/Partials
templateRootPaths.10 = EXT:site_ext/Resources/Private/news/Templates
}
}
This will define alternative pathes for templates.
Now you need to copy the original Templates you want to modify from the subdir in the news extension into your folders.
Then you need to modify the templates.
The template for the list view could be found with the path Templates/News/List.html. the single news are rendered in the partial partial/List/Item.html. There you can find the usage of the viewhelper f:format.crop and the more link (look for the text "more-link")
If you want a complete listing of all news with full text you could replace the item partial with a copy of the template from the detail-view.

How can I access to Flexform Settings when I embed my plugin over TypoScript

I embed a TYPO3 plugin via typoscript and everything is ok. I can access to the TypoScript Settings but not to Flexform Settings. here is my code:
temp.mCOA = USER
temp.mCOA {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = ExtensionName
pluginName = Pi1
vendorName = Vendor
controller = MyController
action = list
switchableControllerActions {
MyController {
1 = list
}
}
view < plugin.tx_extensionname_pi1.view
persistence < plugin.tx_extensionname_pi1.persistence
settings < plugin.tx_extensionname_pi1.settings
}
Can Someone help me Please?
thank you in advance for your help.
If you set your extension within typoscript there is no FlexForm. The FlexForm belongs to an Content Element.
Settings to the typoscript embeded version must be put into the plugin.tx_extensionname_pi1.settings scope per TypoScript.
With Flexform you can provide the abilty to your users to override typoscript settings when they put an new content element with your plugin onto an page.

Get page header and footer preview in backend

I have created a TYPO3 plugin to add new content columns to tt_content.
I need the header and footer content for my preview page in the backend. Once i get the header and footer I can show my contents in between this.
I want to insert some edit features in the content area. that is why I need the html rendered output to a php variable.
I am using templavoila.
I tried this - but got an error:
$this->cObj = t3lib_div::makeInstance('tslib_cObj');
$conf = array('userFunc' => 'tx_templavoila_pi1->main_page');
$content = $this->cObj->USER($conf);
#1316104317: The default controller for extension "myplugin" and plugin "ContentRenderer" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
You can use this TypoScript :
10 = USER
10 {
userFunc = tx_extbase_core_bootstrap->run
pluginName = Pi1
extensionName = EXTNAME
controller = CONTROLLERNAME
action = ACTION
}
Just replace EXTNAME, CONTROLLERNAME, ACTION.