This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 13 - Pages: 1 - Last Post: 08-Aug-2017 19:53 Last Post By: RobM Threads: [ Previous | Next ]
AndreWolff

Posts: 1,999
Registered: 12/14/07
Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 16:14
 
  Click to reply to this thread Reply
To calculate the dimensions of the index page with a table of thumbs, I use the following code:
nrofcolumns= 4;
  nrofrows= 2;
  if (cols>1) nrofcolumns= cols;
  if ((totalImages % cols) == 0) {  this is line 28
  	nrofrows= totalImages/cols;
  }
  else {
  	nrofrows= totalImages/cols + 1;
  }
But I get thgis error message:
illegal use of undefined variable, class, or 'void' literal : at Line: 28 
: in file: inline evaluation of: ``/*   * init.bsh last change: 2017-08-08   */    import se.datadosen.util.*;  imp . . . '' : ) == 0 ) { 
 in init.bsh at line number 28
I use totalImages to get the number of thumbnails on the index page, but apparently trhat does not work.

What else should I use to calculate the number of thumbnails on the index page?
jGromit

Posts: 32,928
Registered: 01/31/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 16:20   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
When you're in init.bsh, there is no "current directory," so it can't possibly know how many images there are. That number will be different for index.html, folder/index.html, folder2/index.html, folder/subfolder/index.html, and so on.

You can check the value of totalImages only from within index.htt.
RobM

Posts: 4,267
Registered: 08/04/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 16:20   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
It depends on the thumbnails, try reading the manuals
AndreWolff

Posts: 1,999
Registered: 12/14/07
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 16:44   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
It depends on the thumbnails, try reading the manuals
The only place where I can find a reference to totalImages
Is the template file:
totalImages Total number of objects, excluding folders, in a directory
And here is not said that you can use it only in index.htt!
RobM

Posts: 4,267
Registered: 08/04/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 16:52   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
RobM wrote:
It depends on the thumbnails, try reading the manuals
The only place where I can find a reference to totalImages
Is the template file:
totalImages Total number of objects, excluding folders, in a directory
And here is not said that you can use it only in index.htt!
It is self evident. But what are you expecting
nrofrows= totalImages/cols
to produce if you have a folder with eight folders, no images and columns set to four?
jGromit

Posts: 32,928
Registered: 01/31/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 17:00   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
totalImages Total number of objects, excluding folders, in a directory
And here is not said that you can use it only in index.htt!

And what directory do you expect it to be telling you about when you're processing init.bsh? The top level? Each of the folders? Each of the subfolders? At that point, it hasn't even started to traverse the project tree.

Like I said, when you're in init.bsh, there is no "current directory."
AndreWolff

Posts: 1,999
Registered: 12/14/07
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 17:02   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
It is self evident. But what are you expecting
nrofrows= totalImages/cols
to produce if you have a folder with eight folders, no images and columns set to four?
You know the manuals, so tell me where I can helpfull information for his problem in the manuals.
AndreWolff

Posts: 1,999
Registered: 12/14/07
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 17:23   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
And what directory do you expect it to be telling you about when you're processing init.bsh? The top level? Each of the folders? Each of the subfolders? At that point, it hasn't even started to traverse the project tree.

Like I said, when you're in init.bsh, there is no "current directory."

I need this information only in the embedd.htt file, but I understand I have to set the statement
engine.setAlbumWidth(indexPageWidth);
in the init.bsh file.
jGromit

Posts: 32,928
Registered: 01/31/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 17:55   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Well, then, you have an interesting problem. What if there are only 2 rows in index.html, 6 rows in folder/index.html, and 20 rows in folder2/index.html? What value do you want to use for the embedding code?

Hint: you probably want to define mostRows in init.bsh, then as you process each folder, do something like mostRows = Math.max(mostRows, thisfolderRows), and then set engine.setAlbumHeight(mostRows * rowHeight) in finally.bsh, when all the processing is done.
RobM

Posts: 4,267
Registered: 08/04/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 18:14   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
RobM wrote:
It is self evident. But what are you expecting
nrofrows= totalImages/cols
to produce if you have a folder with eight folders, no images and columns set to four?
You know the manuals, so tell me where I can helpfull information for his problem in the manuals.
On the page you quoted, for an index page with eight folders and no images or other object types totalImages will give zero.
RobM

Posts: 4,267
Registered: 08/04/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 18:29   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
Well, then, you have an interesting problem. What if there are only 2 rows in index.html, 6 rows in folder/index.html, and 20 rows in folder2/index.html? What value do you want to use for the embedding code?

Hint: you probably want to define mostRows in init.bsh, then as you process each folder, do something like mostRows = Math.max(mostRows, thisfolderRows), and then set engine.setAlbumHeight(mostRows * rowHeight) in finally.bsh, when all the processing is done.

Seems like short pages will sit in an iFrame with lots of vertical white space
jGromit

Posts: 32,928
Registered: 01/31/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 18:38   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Seems like short pages will sit in an iFrame with lots of vertical white space

Yup. Yet another illustration of why iframes are a bad idea.
AndreWolff

Posts: 1,999
Registered: 12/14/07
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 19:36   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
AndreWolff wrote:
RobM wrote:
It is self evident. But what are you expecting
nrofrows= totalImages/cols
to produce if you have a folder with eight folders, no images and columns set to four?
You know the manuals, so tell me where I can helpfull information for his problem in the manuals.
On the page you quoted, for an index page with eight folders and no images or other object types totalImages will give zero.
Nonsense, that is not said on the template variables file,
it contains just one line about variable totalImages:

totalImages Total number of objects, excluding folders, in a directory

The rest suck you out of your thumb!
RobM

Posts: 4,267
Registered: 08/04/06
Re: Is totalImages not defined in init.bsh?
Posted: 08-Aug-2017 19:53   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
RobM wrote:
AndreWolff wrote:
RobM wrote:
It is self evident. But what are you expecting
nrofrows= totalImages/cols
to produce if you have a folder with eight folders, no images and columns set to four?
You know the manuals, so tell me where I can helpfull information for his problem in the manuals.
On the page you quoted, for an index page with eight folders and no images or other object types totalImages will give zero.
Nonsense, that is not said on the template variables file,
it contains just one line about variable totalImages:

totalImages Total number of objects, excluding folders, in a directory

The rest suck you out of your thumb!

Well, I tried, still not sure how you missed the obvious though Total number of objects, excluding folders, in a directory.
Legend
Forum admins
Helpful Answer
Correct Answer

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