TYPO3 6.1
How do I use RTE parse function in an extbase extension?
I am calling the action through ajax and in that action I am getting rte content using a query.
Later I am returning that row like this
$bodytext = $row['bodytext'];
return json_encode($bodytext);
Here I am not outputting this to any fluid template.
So how to parse this $bodytext in RTE parse function, so that I can get richtext output?
Related
I want to pass a value from my fluid code to typoscript. I have two variable (one is int, the other is some text) and I want to use those values in typoscript. Is that possible and if it is possible how?
I want to use the values to create opengraph tags in head of HTML.
Here's my TypoScript
lib.getuserItems = TEXT
lib.getuserItems.wrap = |
page.meta {
og:description < lib.getuserItems
og:description.attribute = property
og:locale = de_DE
og:locale.attribute = property
}
and here's my Fluid
<f:cObject typoscriptObjectPath="lib.getuserItems" data="{article.description}" />
Your problem will not be the parameter transfer.
If you use <f:cObject> in fluid you can compute something with typoscript which is returned and can be used to render the fluid template.
You want some data from your fluid-template transferred to the page configuration (page.meta....) which is not possible in this way.
If you want to set those meta tag data you can use viewhelper in fluid, but that must be PHP viewhelper, that can access page configuration and set these data.
Be aware that TYPO3 9LTS has introduced an API for metatags
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 get the following error message #1237900529: The argument "each" was registered with type "array", but is of type "string" in view helper "TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper" while trying to iterate through the rows of my data using the following FLUIDTEMPLATE (FT) iteration:
<h2>Sources</h2>
<f:for each="{content_source}" as="source">
<p>{source.header}</p>
</f:for>
<h2>Contact</h2>
<f:for each="{content_contact}" as="contact">
<p>{contact.header}</p>
</f:for>
I'm running Typo3 6.2.14 and would like to parse this HTML to match with BootStrap's architecture in my custom built template. I don't have much knowledge on Typoscript & FT; it is however preferable for me to use FT over TypoScript to make conditions for html parsing. What should I adjust if I have the following TypoScript:
10 = FLUIDTEMPLATE
10{
file= fileadmin/Templates/index.html
layoutRootPath = fileadmin/Templates/layouts/
partialRootPath = fileadmin/Templates/partials/
variables {
content_source < styles.content.get
content_source.select.where = colPos=3
content_contact < styles.content.get
content_contact.select.where = colPos=4
}
}
For posterity, since this question is old and likely resolved already:
When you consume a variable from TypoScript this way, you get strings of rendered content - not an array of content records or an array of rendered content HTML strings. So the error is correct.
There are two main roads one would normally take to style the HTML output of the content you render, depending on the type of content element:
Change the TS wrapping etc. (if you use css_styled_content) or override the templates you want to change (if you use fluid_styled_content).
Override the templates you want to change, for all content types and plugins which use either FLUIDTEMPLATE TS object or Extbase MVC.
Lastly, there are third party ViewHelpers you can use in Fluid to fetch raw content records and render them as well - which will allow you to apply things like wrapping to content elements as part of the Fluid template. See https://fluidtypo3.org/viewhelpers/vhs/master/Content/GetViewHelper.html and v:content.render counterpart.
Is it possible to use ckeditor on a form input instead of textarea, i am building a CMS and now trying to add ckeditor and majority of of fields are form input not textarea
Thanks in advance
You can use CKEditor on an element (a div, say) that has contenteditable set. In fact, by default contenteditable elements will have CKEditor editors instantiated. It seems unconventional to use a rich text editor on an input of type text but I imagine it could be done.
As far as I know CkEditor has to be created using a textarea. In saying this, I am using it in a Razor MVC view and its one of the classes in my form..
The request will be blocked though and you will get this error;
A potentially dangerous Request.Form value was detected from the
client
To get around this, you need to get the value of the CKEditor text and html encode it. You can do this
when submitting your form, intercept it on the onsubmit function:
<form id="myform" onsubmit="javascript:onFormSubmit(this);return false" >
...
</form>
Then in this onFormSubmit function
Get the value,
Set the property value to the url encoded value
Do a ajax call to your server with the data
Your function will get the CKEditor encoded value like so:
function onFormSubmit(form)
{
var editor = CKEDITOR.instances["EditorId"];
var richtextValue = editor.getData();
var urlEncodedValue = encodeURIComponent(richtextValue);
// TODO rest of code doing ajax post to submit your form and its data
// Here you need to do an ajax call to your server pass it the form data along with the url encoded CKEditor value for that property
}
Is it possible to get a plugin called with a flexform value?
temp.whatever = HTML
temp.whatever < plugin.tx_myplugin_pi1
Problem is i have a selectbox with two different templates to show:
$this->pi_getFFvalue($this->cObj->data['pi_flexform']
returns "Template1" or "Template2" for example