# How to do an If statement with an XML Gallery??



## davidmknoble (Jun 3, 2008)

I have done many an if statement with the lua programming language for lightroom.  The most common item I use is to include another xxxx.html page if a user checked a box.  For example:

<% if model.metatdata.checkedbox then%>
<%@ include checkboxStuff.html %>
<% end %>

I am working on an XML gallery and I want to accomplish the same thing, but it keeps bombing.  I have limited it to a) just an if statement and b) just an include statement, but in a) the if statements executes each time and in b) it just shows the include statement but won't draw in the file.

I noticed that some of the conventions change from lua to xml, for example

lua:  $model.metadata.textItem.value 
xml:  %metatdata.textItem.value%

Does anyone know the xml convention for:

a) an simple if statement with a checkbox value
b) a simple include *.html page 

Thanks!!!


----------



## Sean McCormack (Jun 4, 2008)

Define a value for the checkbox, a nonCSS one is probably best as for this type of thing. 

eg 
		["nonCSS.checkBox1"] = "false",    

In the Site Info have:
WPGPanelUI.checkbox_row {
							title = "CheckBox1",
							bindingValue = "nonCSS.checkBox1",
						},



Then  in the grid page have       

<% if nonCSS.checkBox1 then%>
<%@ include file="checkboxStuff.html" %><% else %>
<% end %>

Matthew could probably give a better answer, cos he is the guru! 
Also, I'm not sure that you need the else, but most if formats are If Then Else...


----------



## davidmknoble (Jun 6, 2008)

Sean McCormack;153'7 said:
			
		

> Then  in the grid page have
> 
> <% if nonCSS.checkBox1 then%>
> <%@ include file="checkboxStuff.html" %><% else %>
> <% end %>



I have actually tried that coding syntax, but it doesn't seem to work when comming from an xml Web Gallery.  I have had success with the same code using lua, but this application requires using an xml Web Gallery (i.e., galleryMaker.xml versus galleryInfo.lrweb).

I'm sure there's a simple syntax change.  I tried using just '%' and dropping the '<>', but that didn't work even though it calls variables that way.

Hmmm.


----------



## theturninggate (Jun 6, 2008)

I've never done an if/then statement in XML. I'm not even sure that the XML parsing for LR got so far as to include if/then statements before making the switch to Lua.

You might try looking up some XML tutorials. I found this, but not sure whether it will work.

Why are you making an XML gallery? Is it a Flash gallery? If so, Joe Capra might have an idea. I know he's stuck with the XML thus far, developing his Flash galleries. He probably knows it best of all at this point.


----------



## Sean McCormack (Jun 7, 2008)

I stopped using the XSLT galleries after V1.3

I may have to go back for my Flash gallery though.


----------



## davidmknoble (Jun 7, 2008)

theturninggate said:


> Why are you making an XML gallery? Is it a Flash gallery? If so, Joe Capra might have an idea. I know he's stuck with the XML thus far, developing his Flash galleries. He probably knows it best of all at this point.



Actually, this is for Joe's current work.  There are a few items I'd like to add in the html portion of the web galleries.  I have the code working well, but I'd like to give it Joe with the option that user's can turn it on or off.  So, yes, it's flash, and yes, I'm stuck in XML.  

I've used the IF very sucessfully in lua, it's easy!

Thank you, Sean and Matthew for your help.  I'll keep looking and post back if I find a solution.


----------



## Sean McCormack (Jun 13, 2008)

David, it's a bit since the last post, but I suggest for XSL if, look at http://www.w3schools.com/xsl/xsl_if.asp


----------

