TYPO3 seems to alter the output of my Frontend extension.
Simple Testcase:
function main($content, $conf)
{
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
return 'test';
}
When I call a page with this extension in the frontend i get:
test
Basically it prepends the path I used to access the page to the anchor link.
What could be responsible for this behaviour? RealURL?
How can I disable it?
You probably have somwhere in your TS template (in Setup) enabled prefixing:
config.prefixLocalAnchors = all
Note, that if you have set config.baseURL=http://some.tld/ and enabled RealURL this is required, otherwise all anchor links will be redirected to the main page:
http://some.tld/#test
instead of
http://some.tld/pagename/sub/other-sub#test
Related
I have created an extension with sitepackagebuilder.com and the idea is just to write some static html.
I know that when you have a controller you can call the templates by following the convention names. But what if you don't have a controller? What I need, at least for now, is just to install the extension, add the plugin into a page and get some static content in that page.
I can imagine that this is set in a typoscript file but I'm quite noob with all the typoscript thing.
I'm getting this error:
'No Content Object definition found at TypoScript object path "tt_content.list.20.heboorganigram_organigram"'
Until I define that object in my typoscript file. I have tried this.
tt_content.list.20.heboorganigram_organigram = PAGE
tt_content.list.20.heboorganigram_organigram.10 = TEMPLATE //(or FLUIDTEMPLATE same result)
tt_content.list.20.heboorganigram_organigram.10.template = FILE
tt_content.list.20.heboorganigram_organigram.10.template.file = fileadmin/Organigram.html
And then I don't get an error but I also don't get the content from my Organigram.html, this is just trying stuffs, I actually don't know if this is what I need to do.
Before creating new Content Elements you first have to create the Page Template, for that have a look at the sitepackage tutorial https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/FluidTemplates/Index.html
If you already got the page template, have a look at https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html
Provided you already did the steps above, for getting the frontend output you are interested in the step Configure the frontend rendering
So the TypoScript should look something like this:
lib.contentElement {
templateRootPaths.200 = EXT:heboorganigram/Resources/Private/Templates/
}
tt_content {
examples_newcontentelement =< lib.contentElement
examples_newcontentelement {
templateName = NewContentElement
}
}
Then you need to place your Organigram.html file in the Templates Folder in inside the sitepackage.
Is there any hook/signal or anything else so that I can modify final HTML code of frontend page rendered by TYPO3?
My use case is:
I want to apply some regex and logging for links that are displayed across whole website - no matter if the link is rendered via tt_content bodytext (typolink or hardcoded) or by frontend plugin or comes via typoscript or possibly any other way.
The PAGE object in TypoScript has stdWrap, so you can use userFunc there.
page = PAGE
page {
...
stdWrap.userFunc = Your\NameSpace\YourClass->doStuff
}
If you prefer to use real hooks instead of stdWrap you can look at the function generatePage_postProcessing which has three hooks. In the CoreApi Documentation you can find the way how to use hooks.
In your ext_localconf.php you can define your hook usage. As example:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][] = My\NameSpace\Hooks\PageGenerateHooks::class . '->contentPostProcAll'
Now in your hook class you can modify the content:
<?php
namespace My\Namespace\Hooks;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
class PageGenerateHooks
{
/*
* \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
*/
public function contentPostProcAll(TypoScriptFrontendController $pObj)
{
$pObj->content = preg_replace('#mySearch#i','myTerm', $pObj->content;
}
}
new here, and also new to TYPO3.
I need to put something like [imagebox, title='box1'] into content editor and that will be replaced by a text and image with some javascript effect (text and image are managed in the DB elsewhere, the tag is just for the placement in the page).
I've read that TYPO3 has a mechanism for adding custom tags and I managed to make them accepted in the RTE.
I tried instead of [imagebox..... to use
<imagebox>box1</imagebox>
with something like this (copied from web):
tt_content.text.20.parseFunc.tags {
imagebox < lib.parseFunc.tags.link
imagebox = TEXT
imagebox.value= replaced
# imagebox = PHP_SCRIPT
# imagebox {
# stripNL = 0
# Pass a parameter from Typoscript to a PHP script:
# UID of the page containing the SINGLE view of tt_news
# id_singleView = 18
# Call the PHP script
# file = fileadmin/scripts/imagebox_parser.php
# }
}
lib.parseFunc.tags.imagebox < tt_content.text.20.parseFunc.tags.imagebox
should be able to replace content between tags.
I've commented call to php function just tried to get a text replacement for starters.
I've put that in the main root template Setup, but nothing is replaced.
I've also tried other examples from the web with no success.
Did anyone have situation like this?
Are there better approaches for that in TYPO3? (I'm using v7.6.23)
Any suggestion or hint is appreciated.
EDIT: using FSC on textmedia element
I think your examples are outdated. (the object PHP_SCRIPT is obsolete for a long time)
You might have a look at the documentation for your TYPO3 version:
https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/Parsefunc/
you also need to enhance the parsefunc where you need it. That can depend on:
CSC or FSC?
which kind of content element (CE) do you use? (be sure to enhance the rendering of that CE)
I use an own extension which generates the html header and this works fine. Only the default header is still generated, so when we look at the page code there are two htlm headers generated. Even if I use the setting below. Any ideas?
page = PAGE
page.config {
noPageTitle = 1
}
On the rewritten question: how to remove the page title tag.
config.noPageTitle = 2
This is an age-old extravaganza of TypoScript:
https://forge.typo3.org/issues/14929
On the original wording of the question: how to remove page header:
There are two ways, either use
page {
config.disableAllHeaderCode = 1
}
or get a copy of typo3/sysext/cms/tslib/templates/tslib_page_frontend.html, edit it and enable it via
config.pageRendererTemplateFile = /your/path (without page.!)
I have stopped doing that (disabling the header) though, as you will miss out on some useful JS TYPO3 creates (email address encryption, FE Login with RSA).
How can I rename a TYPO3 CMS backend field for authors? i.e. the mentioned field for content-elements of csc_styled_content?
In general, overriding label names can by done with Page TSconfig in the backend. The following example modifies the label of the subheader field.
TCEFORM {
tt_content {
subheader.label = My new Label-Name
}
}
There are two way to configure that adjustment in TYPO3.
Type your configuration changes directly to the page settings » resources » TypoScript Configuration » Page TSConfig (see the screenshot below)
as an alternative you can store that configuration directly in the file system - either in your custom extension (e.g. at typo3conf/ext/my_extension/Configuration/TSconfig/labels.t3s) or with a similar name in the global file storage (e.g. fileadmin/templates/configuration/...)
That's basically it to provide custom labels for any database table in the TYPO3 backend. Find more aspects that can be adjusted in the accordant Page TSconfig documentation.
If you want to rename a field of an extension like tx_news you could do it this way.
TCEFORM {
tx_news_domain_model_news {
title.label = Your New Label
}
}
Now there are two ways to get this to work:
Put it in Page TSConfig of the page settings
OR
Load it with your extension from a file (e.g. EXT:my_extension/Configuration/pageTSConfig.typoscript). For that you have to import this script by EXT:my_extension/ext_localconf.php!
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extrension/Configuration/pageTSConfig.typoscript">');