Assign plugin to Element in typo3 - typo3

Question:
lets say, I have this layout:
(There might be a markup-error, but that is not the most important part)
<div class="helpmaincontainer">
<div class="w-clearfix helpnavi">
<div class="language">
<f:format.raw>{language_menu}</f:format.raw>
</div>
<div class="w-clearfix helptext"><a class="sitemap" href="#">Sitemap | </a><a class="sitemap" href="#"> Impressum</a>
</div>
<f:format.raw>{indexedSearch}</f:format.raw>
</div>
</div>
As you can see, i include some "variables", which i fill in my typoscript.
for my case, the indexedSearch isn't working.
my typoscript looks like this:
indexedSearch =< lib.searchbox
lib.searchbox = COA
lib.searchbox {
plugin.tx_rzautocomplete_pi1
}
But nothing appreas in my frontend.
Thank you in advance

That should be
<f:cObject typoscriptObjectPath="lib.searchbox"/>
see http://docs.typo3.org/typo3cms/ExtbaseFluidBook/8-Fluid/5-using-typoscript-for-rendering-the-cobject-viewhelper.html

Related

Add class to Woocommerce out-of-stock product cards - using Hestia theme

I am using Hestia Wordpress Theme, and I am trying to add a class "out-of-stock" to product cards that meet that condition. I have tried some functions, but without success.
The product card looks like this:
<div class="card card-product pop-and-glow">
<div class="card-image">
... content of card-image ...
</div>
<div class="content">
... here comes content ...
</div>
</div>
I would like to have something like this when the product is out-of-stock:
<div class="card card-product pop-and-glow out-of-stock">
<div class="card-image">
... content of card-image ...
</div>
<div class="content">
... here comes content ...
</div>
</div>
Any hint would be appreciated.
Thanks a lot
R-)

wrap content elements in specific pages differently

All of my content elements are wrapped using stdWrap.wrap.
I am looking for a solution to wrap content elements in the page which i have my ke_search added differently .
Why do you need another HTML-markup?
Normaly you have another <div> around your search results which should enable you to add another styling by CSS.
your page may look like:
<body>
<div class="header">
:
</div>
<div class="content">
<div id="C123">
<h3>my very special CE</h3>
<p class="bodytext">with some text to demonstrate.</p>
</div>
<div id="345">
<h3>your search results:</h3>
<div class="search-results">
<a href="index.php?id=67&s=special">
<div id="C123">
<h3>my very special CE</h3>
<p class="bodytext">with some text to demonstrate.</p>
</div>
</a>
<a href="index.php?id=83&s=special">
<div id="C52">
<h2>just a demo</h3>
<p class="bodytext">this text is nothing special.</p>
</div>
</a>
</div>
</div>
</div>
</body>
with appropiate CSS the first CE looks completely different to the same CE in the search results.
h3 { color:black; font-size:16px; }
p.bodytext { color:#444; font-size:12px; }
.search-results h3 { color:blue; font-size:10px; font-weight:bold; }
.search-results p.bodytext { color:#44b; font-size:10px; font-style:italics; }
I answer my own question:
You can conditionally wrap specific content elements using the following typoscript snippet.
tt_content {
stdWrap {
if.value = tx_kesearch_pi2
{
wrap = |
innerWrap >
}
wrap = <div class="someotherclass">|</div>
}
}

Typo3 Fluid - How do I check if two or more colPos have content and then print HTML

I want to print the following HTML only if one or more of the colPos has content in it. If none have content elements in it, then I don't want to print this block (the whole "row") of HTML.
<div class="row">
<div class="col-sm-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="5" />
</div>
<div class="col-sm-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="6" />
</div>
<div class="col-sm-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="7" />
</div>
</div>
I thought about getting the colPos and try to do a OR condition on Fluid. But I have no idea on how to do it. I know I can check one by one like this:
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.dynamicContent', data: '5')}">
...HTML for colPos 5 HERE...
</f:if>
But I don't want to do that. In my template I have almost 50 different colPos and they are organized by blocks (rows). Like colPos 1 to 5 is one block(row). colPos 10 to 25 in another block(row). But some pages will not use some blocks (rows) of colPos, so there's no reason on printing the HTML code for those blocks (rows) of colPos unused.
Thanks for your help!
A fluid-only solution would be to assign the results of the <f:cObject>-ViewHelpers each to a variable, and then use the concatenation of these variables in a condition. The v:-namespace in the example is the namespace of the extension vhs:
<v:variable.set name="col-5" value="{f:cObject(typoscriptObjectPath: 'lib.dynamicContent', data: '5')}"/>
<v:variable.set name="col-6" value="{f:cObject(typoscriptObjectPath: 'lib.dynamicContent', data: '6')}"/>
<v:variable.set name="col-7" value="{f:cObject(typoscriptObjectPath: 'lib.dynamicContent', data: '7')}"/>
<f:if condition="{col-5}{col-6}{col-7}">
<div class="row">
<div class="col-sm-4">{col-5}</div>
<div class="col-sm-4">{col-6}</div>
<div class="col-sm-4">{col-7}</div>
</div>
</f:if>
You should of course move this stuff to a partial, which gets an array of the columns to print as a parameter. Then you need to write the logic only once.
Also, you should think again, if you really need 25 columns.
Since TYPO3 8.6, this is possible without extension "vhs":
<f:variable name="col-5">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="5" />
</f:variable>
<f:if condition="{col-5}">
<f:format.raw>{col-5}</f:format.raw>
</f:if>

How to parse many div's using Simple HTML DOM?

I have this HTML code
<div id="first" class="first">
One
<div id="second" class="second">
Second
<div id="third" class="third">
Third
<div id="fourth" class="fourth">
Fourth
<div id="fifth" clas="fifth">
Fifht
<div id="sixth" class="sixth">
Sixth
</div>
</div>
</div>
</div>
</div>
</div>
This code is from an external website.
I want to display 'Hi' using Simple HTML DOM from a URL.
Do you want to see something like this?
$el = $html->find("#first", 0);
while ($child = $el->children(1)) {
$el = $child;
}
echo $el->innertext;

How to get the index of the ACTIVE CHILD div of my container with jQuery?

<div id="container">
<div class="active">
<div class="active"></div>
</div>
<div>
</div>
</div>
How to write such a container?
Use .index() without parameters to get it's (0-based) index amongst siblings, like this:
var index = $("#container .active").index();
You can test it out here. For your example markup, it would be 0.