OrangeCD Community Forums  

Go Back   OrangeCD Community Forums > OrangeCD Catalog > Customization, themes and templates

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2009, 11:04 AM
BLOWERS BLOWERS is offline
Senior Member
 
Join Date: Dec 1969
Location: Nottingham, England
Posts: 208
Default How do I script this???

Help! In my template, I want to show an icon in album view that indicates that the entire album is remastered. The trouble is that I have some albums where only SOME of the tracks have been remastered. If I check the 'remastered' box in track properties, this automatically part-checks the remastered box in album properties. But a part-check seems to act as if it is a full check.

I'm probably not explaining myself very clearly! If I script: <dax:if(remastered)><img width=20 src="c:\program files\orangecd\palette1.ico" /></dax:if> I get my icon that shows the album is remastered. But this also shows when I have checked only one track as being remastered! I need the syntax for saying "if ALL TRACKS remastered etc etc", as I only want my remastered icon to show on the album page IF ALL TRACKS ARE REMASTERED!!

I hope a). that someone understands me, and b). can help!

Many thanks.....
__________________
Malc
Reply With Quote
  #2  
Old 05-11-2009, 06:29 PM
andrei_c andrei_c is offline
Administrator
 
Join Date: Feb 2009
Posts: 1,307
Default

Quote:
Originally Posted by BLOWERS View Post
I'm probably not explaining myself very clearly! If I script: <dax:if(remastered)><img width=20 src="c:\program files\orangecd\palette1.ico" /></dax:if> I get my icon that shows the album is remastered. But this also shows when I have checked only one track as being remastered! I need the syntax for saying "if ALL TRACKS remastered etc etc", as I only want my remastered icon to show on the album page IF ALL TRACKS ARE REMASTERED!!
I am afraid it's not doable with current template syntax. Album context simply doesn't offer that level of granularity.

I am sure it can be achieved with JavaScript or CSS hack. Let me think about this overnight, there are several possibilities and I am not sure which is better.

The idea is approximately this (writing from my head, never actually tested it

Code:
<script type="text/javascript">
var all_remastered=true;
<dax:track><dax:if(!trackremastered)>all_remastered=false;</dax:if></dax:track>
if(all_remastered){
  document.write('<img src="...">');
}
</script>
Reply With Quote
  #3  
Old 05-14-2009, 07:37 AM
BLOWERS BLOWERS is offline
Senior Member
 
Join Date: Dec 1969
Location: Nottingham, England
Posts: 208
Default Scripting query...

Quote:
Originally Posted by andrei_c View Post
I am afraid it's not doable with current template syntax. Album context simply doesn't offer that level of granularity.

I am sure it can be achieved with JavaScript or CSS hack. Let me think about this overnight, there are several possibilities and I am not sure which is better.

The idea is approximately this (writing from my head, never actually tested it

Code:
<script type="text/javascript">
var all_remastered=true;
<dax:track><dax:if(!trackremastered)>all_remastered=false;</dax:if></dax:track>
if(all_remastered){
  document.write('<img src="...">');
}
</script>
Thanks Andrei: I await your overnight thoughts with interest! I tried your first quick idea, but it didn't want to work (Template error). Might have been my fault, but I couldn't make it work!
__________________
Malc
Reply With Quote
  #4  
Old 05-17-2009, 06:51 AM
andrei_c andrei_c is offline
Administrator
 
Join Date: Feb 2009
Posts: 1,307
Default

Here's the code that worked for me. Replace <img src="..."> with your image code.

Code:
<script type="text/javascript">
var r=1;
<dax:volume><dax:track><dax:if(!trackremastered)>r=0;</dax:if></dax:track></dax:volume>
if(r){document.write('<img src="...">');}
</script>
Reply With Quote
  #5  
Old 05-17-2009, 08:57 AM
BLOWERS BLOWERS is offline
Senior Member
 
Join Date: Dec 1969
Location: Nottingham, England
Posts: 208
Default

Hi Andrei,

This is weird. I have inserted your script (substituting my image source, obviously), but OCD won't show the icon. It shows the placeholder (white box with red X) and, if I rt. click and select 'properties', it recognises the icon file. Am I missing something??!

Many thanks.
__________________
Malc
Reply With Quote
  #6  
Old 05-17-2009, 09:07 PM
andrei_c andrei_c is offline
Administrator
 
Join Date: Feb 2009
Posts: 1,307
Default

Quote:
Originally Posted by BLOWERS View Post
Hi Andrei,

This is weird. I have inserted your script (substituting my image source, obviously), but OCD won't show the icon. It shows the placeholder (white box with red X) and, if I rt. click and select 'properties', it recognises the icon file. Am I missing something??!

Many thanks.
Image file must be GIF, JPEG or PNG. I don't think IE will recognize anything else.
Reply With Quote
  #7  
Old 05-18-2009, 08:12 AM
BLOWERS BLOWERS is offline
Senior Member
 
Join Date: Dec 1969
Location: Nottingham, England
Posts: 208
Default

Andrei,

The following bit of my template (using 'single' as my field to indicate that the album is fully remastered) DOES return the icon I want to show. AND it is an .ico file!

<h2 class="album"><dax:if(single)><img width=20 src="c:\program files\orangecd\palette1.ico" /></dax:if>


To avoid any risk that I have replaced the path wrongly, could you possibly show your script section with my specific icon path, please? Then I can simply cut and paste your section to replace my existing line (i.e. <dax:if(single)><img width=20 src="c:\program files\orangecd\palette1.ico" /></dax:if>).

Surely it will then show my icon?!! Hope so....
__________________
Malc
Reply With Quote
  #8  
Old 05-22-2009, 04:11 AM
andrei_c andrei_c is offline
Administrator
 
Join Date: Feb 2009
Posts: 1,307
Default

Try this.

Code:
<script type="text/javascript">
var r=1;
<dax:volume><dax:track><dax:if(!trackremastered)>r=0;</dax:if></dax:track></dax:volume>
if(r){document.write('<img src="file:///c:/program%20files/orangecd/palette1.ico">');}
</script>
Reply With Quote
  #9  
Old 05-22-2009, 07:54 AM
BLOWERS BLOWERS is offline
Senior Member
 
Join Date: Dec 1969
Location: Nottingham, England
Posts: 208
Default

Brilliant Andrei - many thanks for your help on this! I'm sure you have better things to do, so your time and trouble is much appreciated. It now works perfectly...
__________________
Malc
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.