Answer the question
In order to leave comments, you need to log in
What are you creating php/tpl/html templates in?
I wrote a treatise and deleted it .. very briefly.
I really liked Jade. I only use it as a syntax shorthand. Killed a lot of time and broke many brains how to marry them with php tags. But there is no final result. Everything rested .. do not believe in the banal lack of transfers to a new line.
<div class="slogan"><?php if ($test == 0): ?>
<p>Test zero</p><?php elseif ($test == 1): ?>
<p>Test one</p><?php else: ?>
<p>Other test</p><?php endif; ?>
</div>
Answer the question
In order to leave comments, you need to log in
but PHP doesn't fit in here...
I use web components, I write templates myself in haml with automatic conversion to html.
Polymer allows you to get rid of such mess on the server completely, because everything works on the frontend.
PS I looked at Jade, I will now switch from HAML, I don't like these things from the world of Ruby. I wish I could replace CoffeeScript with a hundred, but with a ternary operator...) Thanks, @dk-web)
Do you have php compiling jade?
If I understand correctly, you want to do something like this?
doctype html
html
head
style
include style.css
body
<?php if (isHome() == 'index') { ?>
h1 Index page
<?php } else { ?>
h1 <?= $page->title ?>
<?php } ?>
p Welcome to my super lame site.
script
include script.js
function renderJade($file) {
$jadeCompiler = new Jade\Compiler;
ob_start();
include $file; // здесь Jade шаблон
$jadeContent = ob_get_contents();
$template = $jadeCompiler->compileContent($jadeContent);
return $template;
}
print renderJade("path/to/jade/template.php" );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question