TYPO3 TCA Defalut text multiline/textarea - typo3

Can i set a default "multiline value" for textareas in TYPO3 TCA ?
if i use \n for example the output is always \n not a linebreak. The "Default" tag is an integer or String (TYPO3 docu), so it seems not to be possible to enter a default multilined text to a textarea right?
<config>
<type>text</type>
<rows>3</rows>
<cols>30</cols>
<eval>trim</eval>
<default>WILD AND FREE \n SINCE 2008</default>
</config>

You have to adapt to the kind of definition you use.
In general TCA is defined in a PHP file, but you use XML. XML don't know about escaped characters like \n. but the content of tags could include linebreaks, so it would be possible to split the default tag and end it some lines later.
Be aware of indentions!

Related

Prevent htmlspecialchars on variables in TYPO3 Fluid template

In a command controller I am using a StandaloneView to create a plain text file. The (simplified) code I use for that is:
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setFormat('txt');
$view->setTemplatePathAndFilename('EXT:myext/Resources/Private/Templates/test.txt');
$view->assignMultiple([
'test' => 'test&test',
]);
$content = $view->render();
The resulting content if the template is just {test} is test&test, which I'd expect for html format, but not for txt. I've tried setting the format to txt, text and text/plain, but that doesn't affect the result. I know I can use <f:format.raw>, but is there a different way to prevent the HTML characters to be escaped if the format is not html?
I'm using TYPO3 10.4.20.
You can disable output escaping with:
<!-- Disabling HTML escaping for an entire file -->
{escaping off}
Any variables you render will not need to use f:format.raw
even if they contain special HTML entities. Useful when
you render formats other than HTML; or when you completely
trust (read: escaped before assigning to view) all your
variables that get output.
Use with care - caveat emptor!
( https://werkraum.net/devblog/fluid-tipp-8-html-escaping-deaktivieren/ )

Superscript within code block in Github Markdown

The <sup></sup> tag is used for superscripts. Creating a code block is done with backticks. The issue I have is when I try to create a superscript within a code block, it prints out the <sup></sup> tag instead of formatting the text between the tag.
How do I have superscript text formatted correctly when it's between backticks?
Post solution edit
Desired output:
A2 instead of A<sup>2</sup>
This is not possible unless you use raw HTML.
The rules specifically state:
With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags.
In other words, it is not possible to use HTML to format text in a code span. In fact, a code span is plain, unformatted text. Having any of that text appear as a superscript would mean it is not plain, unformatted text. Thus, this is not possible by design.
However, the rules also state:
Markdown is not a replacement for HTML, or even close to it. Its
syntax is very small, corresponding only to a very small subset of
HTML tags. The idea is not to create a syntax that makes it easier
to insert HTML tags. In my opinion, HTML tags are already easy to
insert. The idea for Markdown is to make it easy to read, write, and
edit prose. HTML is a publishing format; Markdown is a writing
format. Thus, Markdown's formatting syntax only addresses issues that
can be conveyed in plain text.
For any markup that is not covered by Markdown's syntax, you simply
use HTML itself. ...
So, if you really need some text in a code span to be in superscript, then use raw HTML for the entire span (be sure to escape things manually as required):
<code>A code span with <sup>superscript</sup> text and escaped characters: "<&>".</code>
Which renders as:
A code span with superscript text and escaped characters: "<&>".
This is expected behaviour:
Markdown wraps a code block in both <pre> and <code> tags.
You can use Unicode superscript and subscript characters within code blocks:
class SomeClass¹ {
}
Inputting these characters will depend on your operating system and configuration. I like to use compose key sequences on my Linux machines. As a last resort you should be able to copy and paste them from something like the Wikipedia page mentioned above.
¹Some interesting footnote, e.g. referencing MDN on <pre> and <code> tags.
If you're luck, the characters you want to superscript (or subscript) may have dedicated codepoints in Unicode. These will work inside codeblocks, as demonstrated in your question, where you include A² in backticks. Eg:
Water (chemical formula H₂O) is transparent, tasteless and odourless.
I've listed out the super and subscript Unicode characters in this Gist. You should be able to copy and paste any you need from there.

Literal HTML markup doxygen

Is it possible to use literal HTML markup in doxygen. By literal i mean
I want this tag here and do not touch it
Background: I want to have this[1] in my documentation, but doing so requires a custom div box, and doxygen breaks it.
[1] \subparagraph{} equivalent in html
I found that \htmlonly does the trick

How to make Zend_Form display special characters in text elements?

I am using a Zend_Form subclass to add and edit records in a database. The layout has iso-8859-1 encoding and charset. The table records use latin1_spanish_ci collation.
The form input text element doesn't display anything at all when the record contains special characters like accents. If there are no special characters the form input text element displays the record correctly. Curiously enough the special characters display correctly when they appear outside the text input field, for example inside an Html heading2 or a paragraph.
I have tried inserting the following in application.ini:
resources.db.params.charset=iso-8859-1
but I get an error message:
SQLSTATE[42000] [1115] Unknown character set: 'iso-8859-1'
I have also tried changing the db charset to utf8 in the same way. The form text element displays the string but I get strange characters instead of the original ones.
I have tried almost anything but I haven't solved the problem. It seems that text input elements generated with Zend_Form hate Latin characters.
Have you had the same problem?
I found this simple solution in a zf forum:
Add the following to your _initView function in bootstrap.php and forget about everything else:
$view->setEncoding('iso-8859-1');

with tinymce, how to convert an html tag into a different format

I want to convert an HTML tag that tinymce returns into a different format.
e.g.
The italics tag I want to convert to #i#
Is that possible with the editor itself?
During postback I strip all html tags, so I need it in a different safer format.
Add an onsubmit call to your form and use a simple javascript function to string replace the html tags you want to keep.
A more constructive method that might achieve what you want is to use the built in 'Valid elements' feature of tinymce. You can specify exactly which HTML tags you want to keep and it will strip out anything else. Plus it might be able to save you the step of stripping out the HTML yourself.
e.g.
valid_elements : "i,b,u",
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements