<div class="user" data-count="число_генерируется_движком">{news}</div>
$(".user").each(function (i, e) {
var count = $(e).attr("data-count");
// далее делаете с этим числом что хотите.
});
<img src="some.svg" alt="svg" />
или в таком духе, ваши события, разумеется, не будут работать, ни в css, ни в js. $prepareString = new Twig_SimpleFunction('prepareString', function ($str) {
return str_replace("%param1%", "Тест", $str);
});
$twig->addFunction($prepareString);
<span>{{ prepareString("Ваша строка с '%param1%'") }}</span>
var hash = window.location.hash;
var selectedOption = null;
if (hash && hash != '#') {
var parts = hash.split('=');
if (parts.length == 2 && parts[0] == "select_option") {
selectedOption = parts[1];
}
}
$lexems = [
"text" => "TEXT",
];
$data = [];
foreach ($_REQUEST as $k => $v) {
if (array_key_exists($k, $lexems)) {
$data[$k] => htmlspecialchars(trim($v));
}
}
$sourceText = file_get_contents("/path/to/template.txt");
foreach ($data as $k => $v) {
$sourceText = str_replace('{' . $lexems[$k] . '}', $v, $sourceText);
}
echo $sourceText;
.menu .menu_item {
border-left: 1px solid #c0c0c0;
}
.menu .menu_item:first-child {
border-left: 0 none;
}
.menu .menu_item {
border-right: 1px solid #c0c0c0;
}
.menu .menu_item:last-child {
border-right: 0 none;
}
table th, table td {
padding: 10px;
text-align: center;
border-width: 1px;
border-style: solid;
vertical-align: middle;
}
table th, table td {
text-align: left;
}
table th, table td {
padding: 10px;
/*text-align: center;*/
border-width: 1px;
border-style: solid;
vertical-align: middle;
}
table th:nth-child(2), table td:nth-child(2),
table th:nth-child(4), table td:nth-child(4) {
text-align: left;
}
<div class="background">
<div class="triangle"></div>
</div>
* {
margin: 0;
padding: 0;
outline: 0 none;
box-sizing: border-box;
}
.background {
width: 100vw;
min-height: 100vh;
display: block;
overflow-x: hidden;
}
.triangle {
background: #404040;
height: 100vh;
display: block;
position: relative;
}
.triangle:after {
content: '';
position: absolute;
bottom: -15rem;
width: 0;
height: 0;
border: 1rem solid transparent;
background: transparent;
border-bottom: 14rem solid #404040;
transform: rotateX(180deg) scaleX(42);
left: 48.8%;
}
var blackCoeff = 1.25; // Коэффициент затемнения
var sectionList;
var blackList;
var counter;
function buildStyles() {
var styles = 'body {' +
'height: ' + ($("body").height() + 'px;') +
'position: relative;' +
'}' +
'.black {' +
'position: absolute;' +
'top: 0;' +
'left: 0;' +
'background: black;' +
'opacity: 0.8;' +
'}' +
'section {' +
'position: relative;' +
'top: 0;' +
'}' +
'section.fixed {' +
'position: fixed;' +
'top: 0;' +
'}';
$('head').append('<style id="sticky-stack-styles" type="text/css">' + styles + '</style>');
}
$(window).on('scroll', function() {
var windowScrollPos = $(window).scrollTop();
var tmpCounter = counter;
counter = 0;
for (var i = 0; i < sectionList.length; i++) {
if (windowScrollPos >= $(sectionList[i]).offset().top) {
counter++;
}
}
if (counter > 1) {
$(blackList[counter - 2]).css("opacity", (windowScrollPos / $(sectionList[counter < sectionList.length ? counter : counter - 1]).offset().top - 1) * (-counter * blackCoeff));
}
if (counter != tmpCounter) {
for (var i = 0; i < sectionList.length; i++) {
$(sectionList[i]).removeClass("fixed");
}
if ((tmpCounter == 2 && counter <= 1)) {
return;
}
$(sectionList[counter - 1]).addClass("fixed");
}
});
$(function () {
$("footer").append("<section/>");
sectionList = $("section");
for (var i = 0; i < sectionList.length; i++) {
var zIndex = (sectionList.length - i) * 2;
$(sectionList[i]).css("z-index", zIndex);
if (i == 0) {
continue;
}
$(sectionList[i]).prepend('<div class="black" style="width: ' + $(sectionList[i]).width() + 'px; height: ' + $(sectionList[i]).height() + 'px; z-index: ' + (zIndex + 1) + '"></div>');
}
blackList = $(".black");
buildStyles();
});