NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Smarty to the limits!


Joined: 04 Feb 2005
Posts: 26
Reply with quote
Hello Dmitri

Nice feature Smarty highlighter.
If you really want to make this perfect. please, please consider adding a new entry under a project where we could save Smarty folder as well as templates folder.
Once these two are configured, phped can read config file of smarty and see what are the language markers and also identify only html that are intended to be templates.

For exemple:
I use [# and #] as delimiters because this way I save usage of literal keyword when in javascript code. If you dont hardcode { and } as delimiters, I can use any smarty config.

Second is that I use htm as template extension so I can edit the files in any html awared editor and also see in any browser easily.
If I can set Smarty config fodler you can read what are the tempalts, and where are they located and only apply highlight on that.

Thank for a great product
Christian
View user's profileFind all posts by CrirusSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
As far as I know people are using {literal} {/literal} blocks for holding javascript, like below:

Code:
{capture name=menu}
<TABLE border=0 cellPadding=0 cellSpacing=0 width=100%>
<FORM action=../tst.php method=post name=tstform onsubmit="tst_beforesubmit();">
<input type=hidden name=currtime value="">
{literal}
<script type="text/javascript">
<!--
function tst_beforesubmit(){
    var d = new Date();
    document.tstform.currtime.value = (d.getMonth()+1) + "." + d.getDate() + "." + d.getFullYear() + "." + d.getHours()
}
//-->
</script>
{/literal}
<tr>
...
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Feb 2005
Posts: 26
Reply with quote
yes, so Smarty dont start interpretting { within js code as own markers.
Now imagine I work with lots of javascript generated on the fly depending on values that are assigned to smarty.
It is quite a job to escape { within js only when required.

Cristian
View user's profileFind all posts by CrirusSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Probably you're right and I just don't understand something, but could you just surround all the javascript code with literals, regardless they are created one the fly or not?

From my point, with [* *] you'll write not portable code and you youself won't be able to use other's code too.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Feb 2005
Posts: 26
Reply with quote
when you add js in same template as the rest of the html code, and then suround the js with literal, all { within that code area is not interpreted by smarty at all.
Now, if I want to do something like

Code:
{literal}
<script>
var myCuteVar={$snartyAssignedValueForCuteVars};
</script>
{/literal}


The above is not interpreted and you get js error I suppose.

If I use [* *] the above is like

Code:
<script>
var myCuteVar=[*$snartyAssignedValueForCuteVars*];
</script>

Simple, no?

This have nothing to do with portability as you can set whatever markers you like in Smarty config file.
View user's profileFind all posts by CrirusSend private message


Joined: 04 Feb 2005
Posts: 26
Reply with quote
Any update thoughts on this? Smile
View user's profileFind all posts by CrirusSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
our highlighter can handle only pair of +one+ symbols as smarty code delimiters. It's a hardcoded limitation we can't get over in PhpED version 4.x.
Probably we'll do it for 5.0.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Feb 2005
Posts: 26
Reply with quote
Hello Dmitri

Any updates on this issue ...was it addressed on PHP5?

Regards,
Christian
View user's profileFind all posts by CrirusSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Sorry, no, this still is not implemented.
I added it to the plans for the next major release.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Smarty to the limits!
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic