How can I pass an argument to a link.typolink for labeling? - fluid

I want to pass to a link.typolink an argument that a link can be label differently! Which view helper do I need to use to output the argument?
<f:if condition="{label}">
<f:then>
<f:link.typolink class="info-btn info-btn--{theme}" parameter="{link}" ></f:link.typolink>
</f:then>
<f:else>
<f:link.typolink class="info-btn info-btn--{theme}" parameter="{link}"><f:translate key="partial.button.Info"/></f:link.typolink>
</f:else>
</f:if>
Therefore I use an if condition. But how do I best pass the value

<f:link.typolink class="info-btn info-btn--{theme}" parameter="{link}" >{label}</f:link.typolink>
I set the argument normally. My problem was to empty the cache

Related

How to use v-text-area rules option?

I am trying to set rules to control buttons that are inside of v-text-area on Vue2/Vuetify. How can I do this?
I tried several things, please do not judge me i am beginner of coding concept
In order to use Vuetify validation rules, you need to wrap all elements on which you want to perform validation in a <v-form> element.
On your input components, you need to provide an array to the rules prop with the names of functions you define which perform validation.
The functions which validate take the value as an input and return true if the input is valid and false or a failure string if the input is invalid.
An example of such a function defined in the methods section would be:
isNumber(input) {
return /[0-9]+/g.test(input) || "input must be a number";
}
Passing it to your v-text-area would look like this:
<v-text-area :rules="[isNumber]" />
More info is available in the #rules section of Vueitfy's Form docs.

how to solve vue short if in v-model?

I need to do a shortif in a v-model, but eslint gives the folowing problem:
[vue/valid-v-model] 'v-model' directives require the attribute value
which is valid as LHS.eslint-plugin-vue
so the code works. but its not the way it needs to work.
this is the code i have now
<v-text-field
v-show="field.type == 'String'"
v-model="_isMultiple(content_data[tabindex]) && subitem != null ? content_data[tabindex][subitem][field.name]
: content_data[tabindex][field.name]"
:label="field.name"
:counter="field.counter"
max-width="100px"
/>
So this code needs a little explanation to it.
I try to build this as an dynamic module. If I get an array back from my json response it needs to v-model the subitem. If I get an object back from the response it just needs to v-model that object.
The data (content_data[tabindex]) + field do i get from a v-for loop and other loops in my vue html
so I think its not an option to do a computed prop because
I can't get in the right data.
_isMultiple function code:
_isMultiple(content_data) {
return Array.isArray(content_data)
}
any solution for this?
Maybe you should not use v-model, but build it on your own with value binding and event listening.
v-model is only a shorthand: https://v2.vuejs.org/v2/guide/forms.html.
By implementing it on your own you can use a method to set the values and a computed property to get it.

How can I pass an index variable from Angular 5's ngFor to a component method?

I have a list of images that I'm looping over and displaying in the browser. Each image has a click handler which only accepts one argument - the image's index. The problem is, I can't quite figure out how to pass that index to the method.
<img *ngFor="let img of images; let i = index"src="{{img}}" alt="{{i}}"
(click)="doSomething({{i}})">
I'd like to be able to pass that 'i' into the doSomething() method but I can't quite figure out how to without getting an error. Help.
Just remove the template braces - the (click) event callback is just plain JS so you can call:
(click)='doSomething(i)'

Print variable name using smarty

Using php Smarty how can i print the variable name instead of value?
Eg. i want to show on the screen this text "{firstname}" instead of the $firstname variable value.
Simply put firstname in the template file where you want it to show 'firstname'.
Do you mean you want to include the characters { and } without them being interpreted as Smarty synax? If so, check out the {ldelim} and {rdelim} "functions" and the {literal} ... {/literal} block function.

Yii Retrieve and store in a variable a renderPartial file

I have a php file under protected/views/directory_controller_name with formatting like that
<p>
<?php echo $model->title;?>
</p>
...
I display the file with classic method in the controller :
$this->render('filename',array('model'=>$model));
But know, I need to send an email with the same template/layout so I want to store the render of the file in an variable like
$msgHTML = $this->renderInternal('_items', array('model'=>$model));
But it doesn't work!
How can I get render view from a file and store in a variable?
Is it possible?
I don't want to use:
$msgHTML = '<p>'.$model->title.'</p>'
...
Because the file is very long and I don't want to duplicate code!!!
Don't use the renderInternal method, use renderPartial instead. Render internal is low level method and should not be used in such context. To catch the output just set the $return parameter to true:
<?php $output = $this->renderPartial('_subView', $dataArray, true); ?>
$msgHTML = $this->renderInternal('_items', array('model'=>$model), true);
http://www.yiiframework.com/doc/api/1.1/CBaseController#renderInternal-detail
I might be missing something, but can't you just use regular render() with the return argument set to true? Then you can just use a view 'name' instead of knowing the path. (And unless my trusty stack trace logger is broken, renderFile and renderInternal take the same fully qualified path argument. At least I can see renderPartial() passing the full path to my view file to renderFile.)
you can do this with these ways
1) if you want to get the output with header and footer (i.e ) full layout then do this
//add true in the last parameter if you want a return of the output
$htmloutput=$this->render('_pdfoutput',array('data'=>'nothing'),true);
2) similarly if you don't want to get the layout files just use renderpartial in the same way
$htmloutput=$this->renderpartial('_pdfoutput',array('data'=>'nothing'),true);
you will get the html of files in the variable . use this anywhere