typolink with empty value - typo3

I try to create a typolink with no Text in it. The result should be:
‌
I have 2 work arounds so far:
adding a non-printing character:
lib.mylink = TEXT
lib.mylink .value = ‌
lib.mylink .typolink.parameter.field = field_link
Result:
‌‌
adding a comment:
lib.mylink = TEXT
lib.mylink .value = <!-- empty -->
lib.mylink .typolink.parameter.field = field_link
Result:
‌<!-- empty -->
Is it possible to get ‌ without a work around?

Just wrap raw URL with a tag manually:
lib.mylink = TEXT
lib.mylink.wrap =
lib.mylink.typolink.parameter.field = field_link
lib.mylink.typolink.returnLast = url

Here is a solution that was working for me:
lib.mylink = TEXT
lib.mylink.value (
)
lib.mylink .typolink.parameter.field = field_link
Important: Keep the empty line after "value (". This will render a simple line break in HTML. The visual result is the same as for an empty a-tag.

Related

How to output COA_INT in fluid template form element

I'd like to pass an extension GP variable to a form that I built outside of the plugin. When trying to do so, I used a COA_INT which turned out to output <INT_SCRIPT. instead of the value.
In order to do so, I built this typoscript object:
lib.gpSWord = COA_INT
lib.gpSWord {
# Protects from XSS!
stdWrap.htmlSpecialChars = 1
10 = TEXT
10 {
stdWrap.data = GP:tx_indexedsearch_pi2|search|sword
}
}
and then tried to output it like this (as suggested here:
<f:form.textfield name="search[sword]" value="<f:format.raw>{f:cObject(typoscriptObjectPath: 'lib.gpSWord')}</f:format.raw>" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword font-h2" />
And also tried building up the variable before hand using f:variable but nothing worked.
The expected result would be that the variable would be set and the value would then be passed to the form.textfield viewhelper but appearently this does'nt work either.
You should commit the variable in Typoscript (setup) with:
page.10 = FLUIDTEMPLATE
page.10.variables.gpSWord < lib.gpSWord
Then you are able to use it in you Fluidtemplate with:
<f:format.raw>{gpSWord}</f:format.raw>
lib.gpSWord = COA_INT
lib.gpSWord {
stdWrap {
wrap = &tx_indexedsearch_pi2[sword]=|
data = GP:tx_indexedsearch_pi2|sword
if.isTrue.data = GP:tx_indexedsearch_pi2|sword
}
}
Try this for GP.

Using special characters as CASE keys in typoscript

I'm trying to send a mail via the powermail extension to different receivers, depending on the value a user has selected in a form dropdown. This practice of dynamic receivers is described in the powermail documentation. Basically:
receivers1.email = CASE
receivers1.email {
key.data = GP:tx_powermail_pi1|field|receiver
1 = TEXT
1.value = receivera#domain.org
default = TEXT
default.value = receiverb#domain.org
}
Now I'm facing the following problem: my values for "receiver" are not numeric (as in the example), but text values from a dropdown. Some of them contain spaces, some of them contain umlauts (öäüß). If I try to add …
Not wörking = TEXT
Not wörking.value = anotheremail#nowhere.org
Typo3 will complain and not update anything. (Bad property!
You must enter a property with characters a-z, A-Z and 0-9, no spaces!Nothing was updated!)
I tried simply 'escaping' the forbidden characters with a backslash, not working. Had an idea of converting the key.data via stdWrap rawUrlEncode, but did not work either. Google came up with this solution, but I don't understand what's going on and could not use it successfully.
How can I get around this? Thanks a lot for any kind of hint!
I pretty like your rawUrlEncode solution. Can you provide us your solution of it here? According to this online converter the result should be something like:
key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.rawUrlEncode = 1
Not%20w%C3%B6rking = TEXT
Not%20w%C3%B6rking.value = anotheremail#nowhere.org
Maybe for each CASE some signs like "%" are not allowed. In that case you maybe refer to the "replacement" function. https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Replacement/Index.html#replacement
key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.replacement {
10 {
search.char = 32
replace = _
}
// Add umlauts and other signs!
}
Not_wörking = TEXT
Not_wörking.value = anotheremail#nowhere.org

TYPO3/Typoscript : trim value failed

This is my typoscript code :
lib.test.renderObj = COA
lib.test.renderObj.10 = TEXT
lib.test.renderObj.10.stdWrap.field = header
lib.test.renderObj.10.stdWrap.case = lower
lib.test.renderObj.10.stdWrap.trim = 1
lib.test.renderObj.10.stdWrap.wrap = <div class="element">|</div>
The header field is well received, letters have been lowercased and the field is well wrapped by a element. The only problem is that i can't make the TRIM properties effective. I also tried to use the search/replace properties -> no success.
Any clue ? :)
You can search and replace since 4.6. The documentation you can find here: https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/Functions/Replacement/
lib.test.renderObj.10.stdWrap.replacement {
10 {
search = # #
replace =
useRegExp = 1
}
}
Don't know if the replace is really working, can't test it.

How do I maintain a string linebreak through a PlayerPref?

I am printing code to a TextMesh, and it is always changing. I need to save the string to a PlayerPref, so that I can load it back up. In order to get the text to fit properly, I have to force a line break in the string, using \n.
string text = "line1\nline2";
PlayerPref.SetString("Text", text);
LocationSide1.GetComponent<TextMesh>().text = PlayerPrefs.GetString("Text");
If I set the text without the PlayerPref it will do a line break:
line1
line2
With the PlayerPref it prints as one line:
line1\nline2
Any ideas on how to fix this?
Seems like the '\' is escaped.
Have you tried to unescape the string ?
using System.Text.RegularExpressions;
[...]
string text = "line1\nline2";
PlayerPref.SetString("Text", text);
LocationSide1.GetComponent<TextMesh>().text = Regex.Unescape(PlayerPrefs.GetString("Text"));
myString = Regex.Unescape(myString);

Reading a hidden text in Word

I use the following to read hidden text.
Globals.ThisAddIn.Application.ActiveDocument.Content.TextRetrievalMode.IncludeHiddenText = true;
var Text = Globals.ThisAddIn.Application.ActiveDocument.Content.Text;
But it doesn't return hidden text. Moreover, if I check TextRetrievalMode.IncludeHiddenText, it's still false - my statement is ignored but it doesn't throw any exception.
How to read hidden text please ?
Accessing the text retrieval mode like in your sample will always return a fresh Range object with the default configuration. You need to get a range object, set the TextRetrievalMode on that object and then get the text from that same object:
var range = Globals.ThisAddIn.Application.ActiveDocument.Range();
range.TextRetrievalMode.IncludeHiddenText = true;
var text = range.Text;