Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24
  1. #11
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,285
    Quote Originally Posted by afriend View Post
    Thank you. I'd actually tried that variation before with this code:

    Code:
    <table border="0" width="100%">[% USE table (excludedgenrelist, cols=3, pad=0) %]
    	[%- FOREACH genrerow = table.rows %]
    		<tr>
    			[%- FOREACH excludedgenre = genrerow %]
    			<td>
    				<input type="checkbox" name="pref_excludedgenre_[% excludedgenre.id %]" id="[% excludedgenre.id %]" value="1" [% excludedgenre.chosen ? "checked" : "" %]>
    				<label for="[% excludedgenre.id %]">[% excludedgenre.name | html %]</label>
    			</td>
    			[%- END %]
    		</tr>
    	[%- END %]
    </table>
    And it did give me the 3 columns I wanted. But I guess I didn't use it because it always reported an error (even though it did the job):


    Either it's unhappy with the way the array of hashes I mentioned in the first post is built or I haven't got the html template syntax part right yet...
    What happens if you remove the parentheses and just have:
    Code:
    [% USE table excludedgenrelist, cols=3, pad=0 %]
    No idea if this is the problem but the parentheses didnĺt exist in Random Mix code.
    If this isnĺt the problem can you post the plugin code that fills excludedgenrelist, sounds like it isnĺt an array based on the error message.
    Erland Isaksson (My homepage)
    Developer of many plugins/applets
    Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )

  2. #12
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,285
    Quote Originally Posted by afriend View Post
    About the HTML::Template table plugin error:


    I've pushed the code to github and the relevant parts are here:
    dstm.pm and dstm.html

    As I've said, it does the job of filling the table but always logs that error.
    The Perl code initialize an array $paramRef->{excludegenres} and then a bit later it push to excludedgenrelist (not excludedgenres) is this correct ? Reading this on an iPad in a web browser so I might be missing things.
    Erland Isaksson (My homepage)
    Developer of many plugins/applets
    Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )

  3. #13
    Senior Member
    Join Date
    Jul 2010
    Posts
    219
    Quote Originally Posted by erland View Post
    The Perl code initialize an array $paramRef->{excludegenres} and then a bit later it push to excludedgenrelist (not excludedgenres) is this correct ? Reading this on an iPad in a web browser so I might be missing things.
    The parentheses don't seem to make any difference. I think I picked them up somehwere in the html::template manual that Michael linked to. "Unfortunately", the typo/wrong paramRef isn't causing this either.

  4. #14
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,530

    html template documentation?

    > Must have done it wrong, it always gave me "1" before. But now I've
    > found a subroutine for that and the genre names are displayed as they
    > should.


    Yeah, I believe this bit me before: you don't assign the result of the
    call to the variable, but the variable would be modified in place...

    > BTW do you have any idea how I can *get rid of the html::template error
    > message* mentioned in 'post 6'
    > (https://forums.slimdevices.com/showt...#post1012366)?
    > Or should I just ignore that?


    I'm sorry, didn't have time to look into this so far. But when I skimmed
    the code I thought you were trying to iterate over an object or
    something. But don't ignore it.

  5. #15
    Senior Member
    Join Date
    Jul 2010
    Posts
    219
    Quote Originally Posted by mherger View Post
    I'm sorry, didn't have time to look into this so far. But when I skimmed
    the code I thought you were trying to iterate over an object or
    something. But don't ignore it.
    I've changed the handler a little and tried to base this as much as possible on how the randomplay plugin does it (here and here). At first I thought something was wrong with the list the table plugin receives (as the error message would suggest).
    Both my plugin and randomplay store a simple (sorted) array with just genrenames in the params for the table declaration and use the hash of hashes with all the relevant information later for each item. Seems the same to me.
    But while randomplay throws no such error my plugin keeps on doing it.

    There must be something (small?) I'm missing. Right now I'm all out of ideas on how to get rid of this error.

  6. #16
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,530

    html template documentation?

    > There must be something (small?) I'm missing. Right now I'm all out of
    > ideas on how to get rid of this error.


    You can dump the content of a variable in the template:

    [% USE Dumper; Dumper.dump(genrelistsorted) %]

    Then look a the rendered page's code in the browser's dev tools

    Oh, and run LMS with --nobrowsecache - otherwise the rendered page could
    be cached with its error, repeatedly returning the incorrectly rendered
    page. Or restart LMS between edits of the HTML template.

  7. #17
    Senior Member
    Join Date
    Jul 2010
    Posts
    219
    Finally! I've figured it out.
    I've moved the code that feeds the params to the settings page into the beforeRender function and no more error.
    Thank you all for your help.

  8. #18
    Senior Member
    Join Date
    Jul 2010
    Posts
    219
    One more thing:

    if you have a html input element with selectfile, a file picker, is it possible to open the file picker at a certain folder?
    It always starts at the root level and I'd like to skip the clicking down the file tree and have it start in the playlistdir folder right away. Is that possible?

  9. #19
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,530

    html template documentation?

    > if you have a html input element with -selectfile-, a file picker, is it
    > possible to open the file picker at a certain folder?


    It should automatically open at the folder defined in the corresponding
    input field. Would you have some code?

  10. #20
    Senior Member
    Join Date
    Jul 2010
    Posts
    219
    Quote Originally Posted by mherger View Post
    > if you have a html input element with -selectfile-, a file picker, is it
    > possible to open the file picker at a certain folder?


    It should automatically open at the folder defined in the corresponding
    input field. Would you have some code?
    Code:
    <input type="text" class="stdedit selectFile_xml" name="pref_restorefile" id="restorefile" value="[% prefs.restorefile %]" size="40">
    I'd like to open the file picker at prefs.somefolder and I need to get the value of prefs.restorefile to pass the restore file path to the restore function. After the function is done prefs.restorefile is set to '' to avoid accidentally restoring from the previously chosen backup.

    BTW I use selectFile_xml. Why does it allow me to choose a folder?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •