In the Typo3 backend I'm redering my email body with a Fluid template. In the following way:
$emailView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
$templateName = 'path/to/email/template.html';
$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']);
$templatePathAndFilename = $templateRootPath . $templateName;
$emailView->setTemplatePathAndFilename($templatePathAndFilename);
$emailView->assignMultiple($variables);
$emailBody = $emailView->render();
In the loaded email template I'm making an absolute link to a page with the following line:
<f:link.action absolute="true" pluginName="name" extensionName="extName" pageUid="{PageId}" controller="Ads" arguments="{uid: uid}">Klik hier</f:link.action>
This is generating a working link only it is not processed by RealURL. Is it possible that is will be done?
You need a valid frontend context for realurl to work. Therefore I suggest that you move your email template to a page type and use a subrequest to render the HTML.
Related
I want to get the html of pdf manager using bean. I know how to get the html for email template but unable to get the html for pdf template which u build in pdf manager.
$template = new EmailTemplate();
$template->retrieve_by_string_fields(array(‘name’ => $template_name,’type’=>’email’));
$html=$template->body_html;
How can i achieve the same functionality when i want to get the html template from pdf manager?
The retrieve_by_string_fields function is deprecated as of 7.6 as per this, so you might want to consider using SugarQuery instead. There's no "type" field in the PDF Manager, so I've just gone with the name attribute from your code. This should provide you with an array of records matching the condition.
require_once("include/SugarQuery/SugarQuery.php");
$sugarQuery = new SugarQuery();
$sugarQuery->select("body_html");
$sugarQuery->from(BeanFactory::newBean('PdfManager'));
$sugarQuery->where()->equals("name", $template_name);
$html = $sugarQuery->execute();
I'm trying to send a Newsletter with tx_news and direct_mail.
The HTML rendering is fine, but I have problems with the plain text and the documentation handles only tt_news.
How do I get the plaintext of tx_news?
Addendum: I only have a Template for the HTML rendering and a Template for the plaintext - the plaintext template is empty yet. I have integrated the template via TypoScript.
plugin.tx_directmail_pi1 {
siteUrl = http://my.domain.com/
}
tx_directmail_pi1.10 = TEMPLATE
tx_directmail_pi1.10 {
template = FILE
template.file = EXT:my_extension/Resources/Private/Layouts/Page/Newsletter.tmpl
}
I propose the following solution: Use a different template for plaintext. This is described in the manual at https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/Templates/Start/Index.html and afterwards use one of those scripts to transform HTML to plaintext. I found https://github.com/mtibben/html2text and https://github.com/soundasleep/html2text or search yourself for "plaintext html to text".
The reason is simple: there is no transformation available in news or the TYPO3 core which transforms the bodytext with its links to plain text.
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).
I created a custom node type with a link field in TYPO3 Neos 1.2.1. When I pass the property value to the template, and try to render it as a link, then an execption is thrown:
Paths must not contain two consecutive slashes.
The link property value is »node://c969f0d4-2e01-87b9-25a8-6079c5a292fe«. I have read, that the link has to be converted to an URI first. However, the suggested processor has no effect on my site.
TypoScript2
prototype(Acme.MySitePackage:Teaser) < prototype(TYPO3.Neos:Content) {
templatePath = 'resource://Acme.MySitePackage/Private/Templates/NodeTypes/Teaser.html'
title = ${q(node).property('title')}
text = ${q(node).property('text')}
image = ${q(node).property('image')}
link = ${q(node).property('link')}
link.#process.convertUris = TYPO3.Neos:ConvertUris {
#forceConversion = true
}
}
Fluid Template
<f:debug>{link}</f:debug>
<neos:link.node node="{link}" />
I bet if you keep the processor and remove the neos:link.node from your template then the
<f:debug>{link}</f:debug>
will show a http:// link to the node.
The error happens with the link ViewHelper which expects a node or node path but neither a node:// not a href:// link (maybe we should support that in the future). So you can use a plain <a href="{link}">
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