Announcement

Collapse
No announcement yet.

Conditional custom variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Conditional custom variables

    I've got a bunch of useful customvars for my products, but they don't apply to every production (more accurately, we don't have all the details for all the products).

    So in my page i've got a line that says "About CUSTOMVAR:AUTHOR", with some room for an author photograph (CUSTOMVAR:AUTHORPICTURE) and a short biography (CUSTOMVAR:ABOUTAUTHOR).

    So far so good. But if we don't have an author picture the web browser displays an "image not found" thingy. Is there a ittle bit JavaScript that I can use to say if(CUSTOMVAR:AUTHORPICTURE !=null) then CUSTOMVAR:AUTHORPICTURE else do nothing?

    Ta,

    Liam

    #2
    You've not said what you keep in AUTHORPICTURE.

    Code:
    If it's <img src="mypic.jpg">
    
    then use
    
    <script language=JavaScript>
    <!--
    if ( 'CUSTOMVAR:AUTHORPICTURE' ) document.write( 'CUSTOMVAR:AUTHORPICTURE' );
    // -->
    </script>
    
    
    If it's mypic.jpg
    
    then use
    
    <script language=JavaScript>
    <!--
    if ( 'CUSTOMVAR:AUTHORPICTURE' ) document.write('<img src="' + 'CUSTOMVAR:AUTHORPICTURE' + '">' );
    // -->
    </script>

    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment

    Working...
    X