|
Welcome, Guest. Please Login or Register. Jul 24th, 2008, 11:37pm
Author |
Topic: If Else Syntax (Read 336 times) |
|
RHDxSPAWNx
Newbie


Posts: 1
|
 |
If Else Syntax
on: Feb 15th, 2008, 9:28pm |
Quote | Modify
|
Ok I have a problem..I made my own lil Folder link. It works for every artist for the project im working on right now. The problem arises with the hyperlink to AC/DC's albums. It treats AC and DC as folders. so here is my sytax i want: <if ARTIST = "AC/DC"> <a href="c:/Documents and Settings/Compaq_Administrator/My Documents/My Music/iTunes/iTunes Music/AC_DC/<!--[title/]-->" target="_blank">Open</a> <else> <a href="c:/Documents and Settings/Compaq_Administrator/My Documents/My Music/iTunes/iTunes Music/<!--[Artist/]-->/<!--[title/]-->" target="_blank">Open</a> </if> iTunes names the AC/DC folder AC_DC. In other words: If Artist is named AC/DC then c://blah/blah/AC_DC/album If not named AC/DC then c://blah/blah/Artist/Album Except, it doesn't work that simple. I tried javascript but that doesn't work for me, the link never appears. I need a tag that works, Artist = "ac/dc" just doesn't work. Help me out EDIT: I also tried using <!--[Artist]--> but that doesn't work because it ends the If syntax for some reason.
|
|
IP Logged |
|
|
|
Firetongue
Administrator
    
Email
Posts: 1135
|
 |
Re: If Else Syntax
Reply #1 on: Feb 19th, 2008, 5:23pm |
Quote | Modify
|
Hi RHDxSPAWNx, You can't achieve this by using template language alone. You will need a combination of dax and javascript here. The IF syntax is very simple: <dax:if(condition)> ... <dax:else> ... </dax:if> ...however, the condition can only be one field or macro variable. The only test possible is one that checks if the field is empty, or if macro variable is "true". E.g.: <dax:if(composer)> - tests if Composer field has anything in it. <dax:if(single)> - tests if Single checkbox is checked. What you need is approximately this: <div id="acdc" style="display:none"> .... <div> <div id="notacdc"> .... </div> <script type="text/javascript"> var a = '<dax:artist/>'; if (a=='AC/DC') { document.getElementById('notacdc').style.display=' none'; document.getElementById('acdc').style.display=''; } </script>
|
|
IP Logged |
Upload your music catalog to Racks and Tags and get free unlimited collection storage - offer ending SOON!
|
|
|
|