Typo3 GP variables in TSSETUP - variables

I use typo3 7.6.10
I learn how get a url variable and store it in other variable for fluid in TSSETUP:
lib.pippomio = TEXT
lib.pippomio.data = GP:cat
example url: index.php?id=10&cat=pino
I print the variable in my template:
<f:cObject typoscriptObjectPath="lib.pippomio" />
Ok it works.
Now i need to print the variable in input by Search Indexed Engine:
<input class="tx-indexedsearch-searchbox-sword" id="tx-indexedsearch-searchbox-sword" type="text" name="tx_indexedsearch_pi2[search][sword]" value="progetto">
How can i store in lib.pippomio the POST Variable "tx_indexedsearch_pi2[search][sword]" ???
I tried
lib.pippomio.data = GP:tx_indexedsearch_pi2[search][sword]
But it doesn't works.
I want to print the word searched in an other place.

You can use a pipe "|" to get it
lib.pippomio.data = GP:tx_indexedsearch_pi2|search|sword
TYPOSCRIPT Reference => getText

Related

Update attributes on existing iframe elements in nvarchar column via SQL

I've implemented code inside a ckeditor that replaces the src attribute of iframe elements with data-src and adds the data-cookieconsent attribute. In addition, a placeholder div is added after the iframe element. Regex is used to match the iframe elements in the string.
var value = CKEDITOR.instances.editor1.getData();
const regex = new RegExp('(?:<iframe[^>]*)(?:(?:\/>)|(?:>.*?<\/iframe>))');
const matches = value.match(regex);
if (typeof matches !== "undefined" && matches != null) {
matches.forEach(element => {
if (!element.includes("data-cookieconsent")) {
value = value.replace(element, element.replace("src=", "data-add-placeholder data-cookieconsent=\"marketing\" data-src="))
value = value.replace("</iframe>", "</iframe><div class=\"row justify - content - center\">" +
"<div class=\"cookieconsent-optout-marketing blocked-media-placeholder\">" +
"<div class=\"col-xs-6 col-xs-offset-3\">" +
"<h3>For at se denne video skal vi bruge dit samtykke til at anvende cookies.Venligst tryk på dette link og vfremvist denne video.</h3>" +
"</div></div></div>")
}
});
}
However, I now need to replace the currently existing iframe elements and add the placeholder div in the database using sql. I'm aware that I can use update with the replace function to update parts of a text column, but this seems to require Regex to work, which as I understand, is quite limited in T-SQL.
What would be the best approach to this problem? How can I ensure only the iframe elements in the column are altered?

Alfresco : How to search for a specific files types?

I am working to search all PNG files(i.e. all files which has file name extension ".png") in alfresco.
I am using the followingcode, but it does not return any result:
var docs = search.luceneSearch("#cm\\:content.fileType:\"*.png\"");
for (var i=0; i<docs.length; i++)
{
//TO print the name of files--> "Name: " + docs[i].name ;
}
I am not sure if content.fileType is the right way to code to search for file types. Any suggestion please ?
You should go with the content.mimetype query, for example: #\{http\://www.alfresco.org/model/content/1.0\}content.mimetype:text/plain
https://community.alfresco.com/docs/DOC-4673-search#jive_content_id_Finding_nodes_by_content_mimetype
If I use this statement, it helps to find only PNG images:
var docs = search.luceneSearch("#cm\\:name:\"png\"");
If your really want to search for PNG files you should follow Lista's approach using mimetype but with correct syntax
var docs = search.luceneSearch("#cm\\:content.mimetype:\"image/png\"");
searching for name part "PNG" ("#cm\:name:\"png\"") would find any document having a token "PNG" in it's name like png.name.pdf or any_png.doc since document name is stored tokenized in the index

Getting a vaule in a link for later usage in Selenium

I have a link on my webpage which I need to get the value from and save in for later usage (constructing a direct URL).
The html-link I want to obtain the value from look like this:
<a ng-bind="saving.customerContractName || (saving| savingscontract:$parent.$parent.cmsData) " ng-attr-target="{{(saving.type === 'ASK') ? '_blank' : undefined}}" ng-href="/lpn/mo/Logon.action?avtalenummer=176742" class="ng-binding" target="" href="/lpn/mo/Logon.action?avtalenummer=176742">Fondskonto Link (176742)</a>
The value I need to obtain is 176742.
Any tips on how to extract this value? And further use it in a direct URL call (something) like this:
String url2 = "https://www2-t.storebrand.no/ppjs/#/savings/index/THE_VALUE_HERE";
driver.get(url2);
this might work.
txt = driver.find_element_by_partial_link_text("Fondskonto Link").get_attribute("href").split("=")[1]
url = "https://www2-t.storebrand.no/ppjs/#/savings/index/%s" % txt
driver.get(url)

How to write value to input field

I am getting element with
var nameEl = document.getElementById("<portlet:namespace />kategorijaName");
that is input field.How can i write some text in it ?
Since the question (at this time) is tagged liferay and alloy-ui, I am assuming an answer using/appropriate for those two tags would be beneficial
<aui:input id='textFieldId' name='textFieldName' label='My Text Field'></aui:input>
<script>
AUI().use('node', function(A){
A.one('#<portlet:namespace/>textFieldId').set('value', "A new input value");
});
</script>
if you are using normal javascript then you can use below for setting a value in input text
document.getElementById("<portlet:namespace />kategorijaName").value = 'some value';
in case of Jquery you can use
$("#<portlet:namespace />kategorijaName").val("some value");
If you are using alloy-ui then you can set value like this
<aui:script>
A.one('#<portlet:namespace />kategorijaName').set('value',kategorijaName);
</aui:script>
nameEl.value = "value you need"

How to inject a variable inside an SQL associated array?

I have many websites that use some of the same content snippets and instead of manually updating all the different websites, I thought it would be a good idea to have the content stored in a database as to only have one copy instead of multiple. It works great except for one issue which is the images that are in the article are sometimes left aligned and other times right aligned.
My solution was to add the following code to the article's image CSS tag that is in the database and use a variable on each of the individual pages to add the custom classes to the image.
class="<?php echo $ImgClass01; ?>"
EDIT: here is more of the content from what is stored in the database field to make my question a little more understandable.
<p><img src="img/charleston.jpg" class="<?php echo $ImgClass01; ?>">Is it the delightful year-round climate? The almost-European feel of its downtown city streets? The overwhelming...</p>
However, the webpage is only showing the text when viewing the source code and not using the variable. Almost anything is possible, but I'm not sure how to make this work.
Here is the code on the page...
// value for the class within the article to be printed on the page
$ImgClass01 = 'img-responsive img-rounded pull-right';
//Start a while loop to process all the rows
while ($row = mysql_fetch_assoc ($result_set))
{
$article = $row['article'];
echo $article;
} //END WHILE
EDIT: Just in case the entire page will be helpful, here is it.
<?php
$PageTitle = "Charleston, South Carolina | Local Towns";
$PageDescription = "Charleston is rated the first most popular vacation destination in the United States, and it surely must rank in...";
// 1. Create a database connection
$link = mysql_connect ("localhost", "root", "");
if (!$link) die("Could not connect: " . mysql_error());
// 2. Select a database to use
if (!mysql_select_db ("articleBank"))
die("Problem with the database: " . mysql_error());
// 3. Set up query for items to display
$query = "SELECT article FROM `articles` WHERE ID = 1";
// 4. Execute the query
$result_set = mysql_query ($query);
include ("theme/header.php");
// value for the class within the article to be printed on the page
$ImgClass01 = 'img-responsive img-rounded pull-right';
//Start a while loop to process all the rows
while ($row = mysql_fetch_assoc ($result_set))
{
$article = $row['article'];
echo $article;
} //END WHILE
// 5. Close Connection
mysql_close();
include ("theme/footer.php");
?>
while ($row = mysql_fetch_assoc ($other_result_set))
{
$ImgClass01 = $row['ImgClass01'];
}
not sure what you wanted, but you could use left, right in some row like place..