If statement inside include tag, smarty? - html

I want to have an if statement (or something that can do the following functionality) inside a include tag in smarty. I have the following include tag:
{include
file="controls/control_input.tpl"
//some other smarty variables
mask=$itemType->mask
mask=$field['mask']
}
my goal is to essentially have mask be set to itemType->mask if field["mask"] is = to "", otherwise it should be set to field["mask"]. However, I am unable to have a if statement inside the include tag it seems.

Related

What does a reference inside a div tag without an attribute do?

I would like to start using Attribute Selectors in my css. I am seeing div tags that contain a reference WITHOUT any attribute statement like:
<div class="container" data-footer>
All my searches (for the last hour) to find out how "data-footer" can be listed without the use of an attribute= (e.g., id= or class= or etc.) have resulted in no information. Dozens of SO and Google links without a single example of a reference inside a div tag without the use of an attribute. Because I do not know what this is (or what to call it) I'm probably not searching with the right keywords. Is this a short-form way to pass an id or ???
Data- attributes without a value can be used as Boolean. For example:
if(div.hasAttribute('data-footer')) {
// then do something
}
In css you can access it like:
div[data-footer] {
}

TagHelper to supress Razor processing

Is there a possibility to write a tag helper which tells Razor not to process it's content.
I would like to define new <raw> tag and everything between opening and closing "raw" tag should go to result HTML "as is".
For example, the following markup:
<raw>
Some text.
#Something
<some-other-tag-helper />
<raw>
Should go to result HTML exactly as it's listed between <raw> and </raw> without trying to consider #Something as a variable or "unpacking" other tag helpers.

How to put a tag inside data-description

I have a'a' tag, something like this:
How can i put a link inside the data-description tag, so that i have a link inside a description link.
You can just write a tag there, e.g.
...
The value of an attribute is parsed as plain text, except for character/entity references, so the less than character < is just another data character.
Nothing inside a data-* attribute value is parsed as a tag, but that’s a special case of the fact that it is unspecified text. All use of such attributes is by definition dependent on what you do in your page or application. So if you need something to be interpreted as tags, just write the processing so that they will be so interpreted.
You cannot nest tags inside of tag attributes.
You can refer to this: Link inside a div link

How to show the string inside a tag verbatim?

What tag can I use to prevent any interpretation? I need that because I need to write down some source code and it's result in blogger. I have this code in blogspot, but the code inside the <pre> is processed
The code is as follows:
<pre class='prettyprint'>
$latex \displaystyle S(n)=\sum_{k=1}^{n}{\frac{1}{T_{k}}=\sum_{k=1}^{n}{\frac{6}{k(k+1)(k+2)}$
</pre>
This is the result:
$latex \displaystyle S(n)=\sum_{k=1}^{n}{\frac{1}{T_{k}}=\sum_{k=1}^{n}{\frac{6}{k(k+1)(k+2)}$
When I can replace '$' in <pre> with something equivalent, I could avoid this issue.
I tried <code> and <pre>, but they all interpret the content.
ADDED
I'm trying to use the javascript code found in this post.
If I understand correctly, you are using Replacemath, and its documentation says: “Should you need to to prevent certain $ signs from triggering LaTeX rendering, replace $ with the equivalent HTML <span>$</span> or $, or put the code inside a <pre> or <code> block if appropriate.” Of these, the first method seems to actually work.
That is, replace all occurrences of “$” inside the pre element by <span>$</span>.
I tested this by publishing a test in my blog (which had been dormant for 6 years...). I had to manually break the pre block to fit into the column.

Get rid of HTML tags in a block in Smarty

How can I get rid of HTML tags in a Smarty block?
I've tried {strip} within the block and it did not work.
Also I tried to write a plugin. But how can I parse the content of a block into a string variable?
The {strip} block actually does something else - it only strips whitespace off markup.
You could write a simple block plugin:
function smarty_block_sanitize($parms, $content, &$smarty, &$repeat ) {
if( $repeat ) {
return( strip_tags( $content ) );
}
}
Put this somewhere in a PHP file called before displaying the template. To use it in template, do this:
Sample text {sanitize}<more markup>test</more markup>{/sanitize} End text.
Beware allowing tags with strip_tags (with its PHP parameter), since onclick / onmouseover / other wicked attributes do not get filtered.
You can {capture} a block to a variable and then use PHP's strip_tags() on it:
{capture name="withtags"}
<em>Text</em> with <strong>tags</strong>
{/capture}
{$smarty.capture.withtags|strip_tags}