#127 remove undefined variables, removes to much

closed-rejected
Template (13)
5
2004-04-21
2003-07-25
Anonymous
No

Undefined variables are removed by this line in
template.inc:

$str = preg_replace('/{[^ \t\r\n}]+}/', "", $str);

this removes maybe CSS styles in the template file,

for example:

h1 {color:black}

would be removed or commented:

h1 <!-- Template $handle: Variable color:black
undefined -->

if tryed this, maybe you use it:

$str = preg_replace('/{[^ \t\r\n\:\;}]+}/', "", $str);

so : and ; wouldn't match the regular expression and
CSS or JavaScript Code between {} won't be removed.

Discussion

  • Richard Archer

    Richard Archer - 2004-04-21
    • assigned_to: nobody --> richardarcher
    • status: open --> closed-rejected
     
  • Richard Archer

    Richard Archer - 2004-04-21

    Logged In: YES
    user_id=279311

    I'm of two minds about this one. But I think that it's best not to
    risk breaking existing applications with this change.

    There is a very simple work-around... add a space to your style
    sheet or javascript. Template variable names cannot contain
    spaces or tabs, and there is no reason why they cannot be added
    to prevent deletion by template.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks