Open GoogleCodeExporter opened 9 years ago
enhancement category may suit this issue better
Original comment by complex...@gmail.com
on 24 Oct 2011 at 2:33
This would make the parser less reliable, since you could have JavaScript
blocks mistaken for commands - for example:
<script type="text/javascript">
var $a = 1;
function xyz() {
$a += 1;
}
</script>
The parser would see { $a += 1; } and this would look like a command. Worse,
this particular example would probably even compile, and both the compiled
template and the JavaScript would fail.
Original comment by ras...@mindplay.dk
on 25 Oct 2011 at 1:43
Shouldn't you have to wrap inline css/js blocks in {ignore} blocks anyway?
I understand that that this would not be backward compatible, I'm trying to
migrate from templatelight, and the whitespace sensitivity really bugs me.
Original comment by complex...@gmail.com
on 25 Oct 2011 at 8:16
> Shouldn't you have to wrap inline css/js blocks in {ignore} blocks anyway?
You shouldn't be forced to use ignore tags - suppose you want to insert a
template variable into a JS snippet, for example:
<script type="text/javascript">
var name = '{$name}';
</script>
I suppose we could have a configuration switch to ignore whitespace. You're
welcome to submit a patch - I haven't worked on the engine myself in almost 2
years. Most of my work is currently in .NET, and it'll probably be another year
before I return to PHP, at which point I'd like to integrate Outline with the
Yii framework...
Original comment by ras...@mindplay.dk
on 25 Oct 2011 at 1:34
as for now, i use smarty/templatelite this way (only its called {literal}
there), moving js variable assigns out to a "safe place" where no {ignore}
needed (code with no braces), and everyting else goes in {ignore}-s afterward,
so it looks like this:
<script>
var from_php = '{$stuff}';
{ignore}
function a() { // code using the variable from php ... }
{/ignore}
</script>
patch attached (diff against trunk in svn), and i want to thank you for the
code, makes my life much simpler when objects are involved (-:
Original comment by complex...@gmail.com
on 25 Oct 2011 at 1:59
Attachments:
This is for the 1.0 branch, which I abandoned a long time ago. Have you looked
the 2.0 branch?
http://code.google.com/p/php-outline/source/browse/#svn%2Fbranches%2F2
Original comment by rschu...@gorges.us
on 26 Oct 2011 at 1:37
I have, but as for now (rev201) there's no include support and I'm using that
all over the place. If I understand it correctly then {block} -s could be used
for same thing, but for layouts i need the included file run in the same scope
(or have access the variables that its caller had), but this should go to the
planning 2.0 discussion board.
Anyway, i attached a patch with the same ignore_whitespace_near_brackets moved
to the config array, also one removed a call time reference warning (explicitly
deprecated syntax since php 5.3.0 ).
Original comment by complex...@gmail.com
on 26 Oct 2011 at 9:53
Attachments:
Original issue reported on code.google.com by
complex...@gmail.com
on 24 Oct 2011 at 2:32