Permlink Replies: 3 - Pages: 1 - Last Post: 03-Jul-2019 18:19 Last Post By: davidekholm Threads: [ Previous | Next ]
ctwist

Posts: 565
Registered: 27-Sep-2003
Find deprecated scripting techniques
Posted: 30-Apr-2019 05:56
  Click to reply to this thread Reply
jAlbum 17.1 introduced an improved, less tolerant, scripting engine. This caused some skins to break. This message describes how you can find some scripting errors.

1) As we all know, variables were originally referenced by
$varname
but the revised syntax is
${varname}
The old syntax worked until jAlbum 17.1 (and in most circumstances it still works). I thought that I had fixed this in ExhibitPlus and BluPlusPlus, but I had overlooked a few instances of the wrong syntax.

So how can you find all of the obsolete references to variables in a skin? This is what I will show you.

In the "Edit" menu, select "Word Wrap".
In "Options", select "Contents - Regular Expression".
Set "Containing text" to \$A-Za-z0-9
Set "Look in" to the skin directory path.
Select "Search subfolders".
Click "Start".
A list of files that have errors is shown, Select the "Hits" tab to see the lines of text that contain errors.
Double click a file name to edit it.
  • Fix files with suffixes .bsh .htt .inc .xbp .pht .js (if you use JavaScript for album generation) and maybe .java. Do not change run-time files with suffixes .js .php .pl.
  • You may want to run this for ExhibitPlus 1.8.1 to see what the errors look like.
2) If a <ja:include> statement does not have a corresponding </ja:include> statement, it must be terminated with />.
e.g.
<ja:include myscript>
should be
<ja:include myscript />
This was previously accepted, but now it fails. You can use Agent Ransack to find these, but de-select the "Contents - Regular Expression" option.

3) Prior to jAlbum 17.1 a Java scriptlet in a bsh or htt file could contain a variable, e.g.
String myvar = <%= Myclass.mymethod(${currentPage},  ..........); %>
This must be changed to something like
String myvar = <%= Myclass.mymethod(currentPage, ..........); %>
To find these problems, you should search for each instance of "<%" and review each $.

4) A constant is expressed as $text.name. These should not be changed. You can add {}, but this is not required and can cause problems. Since jAlbum 17.1, if a Java scriptlet contains a constant with {}, the constant will not be evaluated, so do this
<%= Myclass.mymethod($text.myconstant,  ..........);
instead of
<%= Myclass.mymethod(${text.myconstant},  ..........);


Edited by: ctwist on 30-Apr-2019 11:22
Incorporate David's feedback; added section 4.

Edited by: ctwist on 03-Jul-2019 12:17
In step 2) change "include" to "ja:include".
davidekholm

Posts: 3,611
Registered: 18-Oct-2002
Re: Find deprecated scripting techniques
Posted: 30-Apr-2019 14:08   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
Thanks for this tip! The old syntax should still work for constants, so I don't see why $text.indexPage won't work (note the lack of braces).
ctwist

Posts: 565
Registered: 27-Sep-2003
Re: Find deprecated scripting techniques
Posted: 30-Apr-2019 14:26   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
Yes $text.indexPage does work, but I thought this this was considered "old syntax". If that is acceptable, this simplifies my changes.
davidekholm

Posts: 3,611
Registered: 18-Oct-2002
Re: Find deprecated scripting techniques
Posted: 30-Apr-2019 15:09   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
ctwist wrote:
Yes $text.indexPage does work, but I thought this this was considered "old syntax". If that is acceptable, this simplifies my changes.

Yes, it's perfectly fine for constants like those
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums