I've a object with some HTML code. I want to use a constant inside. My code is the following:
15 = TEXT
15 {
data = getenv : TYPO3_SITE_URL
wrap (
<div class="c-menu-share__item social-xing"></div>
<div class="c-menu-share__item social-linkedin"></div>
<div class="c-menu-share__item social-facebook"></div>
<div class="c-menu-share__item social-email"></div>
)
}
15.outerWrap = <div class="c-menu-share">|</div>
That doesn't work. Can anybody help me?
Thanks in advance!
You can´t use 'data' as a variable, but you can get your environment variable via {getIndpEnv : TYPO3_SITE_URL} (or {getIndpEnv : TYPO3_REQUEST_URL} if you want the url of the current page) directly. Try this:
15 = TEXT
15.value (
<div class="c-menu-share__item social-xing"></div>
<div class="c-menu-share__item social-linkedin"></div>
<div class="c-menu-share__item social-facebook"></div>
<div class="c-menu-share__item social-email"></div>
)
15.insertData = 1
Related
I am making several loan calculators in Symfony 5, all are in my controller SimulatorController.
The user is filling up / submitting a form in the View 1 and should land on View 2 where calculations results appear, along with a recpa of data entered in the form.
So I have a first function in my controller which creates the calculation form, make some calculations, render the form into the view 1 and redirects to View 2 once the form is submitted :
#[Route('/rachat-credits', name: 'app_rachat')]
public function rachat(Request $request)
{
// Debts rate
$form = $this->createForm(SimulDebtFormType::class);
$debtForm = $form->handleRequest($request);
if($debtForm->isSubmitted() && $debtForm->isValid()){
$wages = $debtForm->get('salaries')->getdata();
$bonuses = $debtForm->get('bonuses')->getdata();
$earnings = $debtForm->get('earnings')->getdata();
$expenses = $debtForm->get('expenses')->getdata();
$totalIncome = intval($wages + $bonuses + $earnings);
$rate = floatval($expenses/$totalIncome*100);
$debtRate = number_format($rate, 2,',',' ');
$rest = $totalIncome - $expenses;
$restToLive = number_format($rest,0,'',' ');
return $this->redirectToRoute('app_simul_res_endet');
}
return $this->render('Simul/rachat.html.twig', [
'debtrateform' => $debtForm->createView(),
]);
}
And a second function to render the View 2, which displays the results from the previous a form and create a contact form on it.
I don't manage to pass the retrieved and calculated data into the View 2, I tried to enter parameters in an array into redirectToRoute(), such as:
return $this->redirectToRoute('app_simul_res_endet', [
'debtRate' => $debtRate,
'restToLive' => $restToLive,
'totalIncome' => $totalIncome,
'expenses' => $expenses,
]);
but the View 2 did not recognized the variables.
<div class="row justify-content-evenly align-items-center text-center fw-bold m-3 endettement">
<div class="col-sm-6 col-md-4 rounded-3 p-4 mb-4 data">
<div class="row justify-content-around align-items-center fw-bold">
<div class="col-10 text-start">
<p>Mes revenus mensuels</p>
<p>Mes charges mensuelles</p>
</div>
<div class="col-1 text-end figures">
<p>{{ totalIncome }}€</p>
<p>{{ expenses }}€</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 results rounded-3 p-4">
<h3>Estimation de votre
taux d'endettement*</h3>
<h3 class="mensualite">{{ debtRate }}%</h3>
<h3 class="mt-4">Reste à vivre*</h3>
<h3 class="mensualite">{{ restToLive }}€</h3>
<button class="btn ctaWhite text-uppercase rounded-pill mt-4">Recalculer</button>
</div>
</div>
Anyone has a clue or advice on how to proceed?
I have a simple text element with a variable src value. What I want to do is to make a typolink around that.
footerlogo = TEXT
footerlogo {
value = {$footerlogo}
wrap = <div class="elRightImg"><figure class="imageWr"><img src="|" alt="Footer Logo" style="max-width: 300px;"></figure><div class="clear"></div></div>
}
Output should look like this:
<div class="elRightImg"> ... </div>
You want to look for the typolink function and its property ATagBeforeWrap :)
footerlogo = TEXT
footerlogo {
value = {$footerlogo}
typolink.parameter = http://www.example.com
typolink.wrap = <div class="elRightImg"><figure class="imageWr"><img src="|" alt="Footer Logo" style="max-width: 300px;"></figure><div class="clear"></div></div>
typolink.ATagBeforeWrap = 1
}
Should work.
Documentation:
https://docs.typo3.org/typo3cms/TyposcriptIn45MinutesTutorial/TypoScriptFunctions/Typolink/Index.html
https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html
If the html looks as follow:
<form>
<div>
<field-component>
<div class='field'></div>
</field-component>
</div>
<div>
<div class='icon'></div>
</div>
</form>
I am able to get the field using fieldElement = element(by.css('.field')), but how can I get the closest element with the icon class?
try this:
var form = element(by.css('form'));
return form.element(by.css('.field')).isPresent().then((present) => {
if (present) {
return form.element(by.css('.icon')).click(); #click or whatever on this element
}
});
I am trying to get a wrapper element around an image including its caption in the single view in tt_news for Typo3 6.1. How would I do that?
So far I only figured out how to do that for either all images
plugin.tt_news.displaySingle.imageWrapIfAny = ...
or the caption itself
plugin.tt_news.displaySingle.caption_stdWrap.dataWrap = ...
. But I have no clue how to create a wrapper for each single image including its caption...
Thanks in advance!
I know this is quite old, but as a follow-up that works in TYPO3 6.x you can use:
displaySingle.image.wrap = <div class="news-img">|
displaySingle.caption_stdWrap >
displaySingle.caption_stdWrap.wrap = <p class="news-single-imgcaption">|</p></div>
So each image and caption gets wrapped by <div class="news-img">...</div>
The following HTML will be provided by the below TS:
<div class="newsImage">
<div class="imageHolder">
<img />
</div>
<div class="captionHolder">
Caption
</div>
</div>
TypoScript:
displaySingle {
imageWrapIfAny = <div class="newsImage">|</div>
image {
file.maxW >
file.maxH >
file.width = 220
stdWrap.wrap = <div class="imageHolder">|</div>
altText.field = imagealttext
}
caption_stdWrap >
caption_stdWrap.wrap = <div class="captionHolder">|</div>
}
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;