Also To have switch cases for multiple values, use a delimiter
<cfcase value="A;a" delimiters=";"> -----Original Message----- From: Robertson-Ravo, Neil (RX) [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 12:20 To: CF-Newbie Subject: RE: newbie questions Well CFWITCH and CFCASE are pretty standard coding processes. <cfswitch variable="#yourvar#"> <cfcase value="a"> Do A </cfcase> <cfcase value="b"> Do B </cfcase> <cfcase value="c"> Do C </cfcase> </cfswitch> #yourvar# is your variable and it could be anything...a URL var etc. There are no need for breaks in each case as if I pass in 'a' to your var it will only ever do that case statement. To suppress whitespace try and not wrap everything around a CFOUTPUT - be liberal with its usage - try and use it only around dynamic content where possible. Rule of thumb, if it doesn't need to be around something then don't add it ;-) -----Original Message----- From: Simon Cornelius P. Umacob [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 12:12 To: CF-Newbie Subject: newbie questions Hi there! I'm new to ColdFusion. I used to code in PHP for developing web apps, but I had to learn this language (I only started this Monday) because our company requires me to do so. Initially, I found CF frustrating because it is very inflexible in many areas. However, I'm beginning to appreciate CFs ability to speed up developing time, although the ColdFusion language is not as beautiful and concise as PHP and other C-like languages. I hope you guys can help me with my transition. I have many questions in mind: - How can I define constants? I need to use constants because <cfcase> does not accept variables. Is there a #define or define() equivalent in CF? - In CF, I have the impression that <cfswitch> doesn't need to break after each <cfcase>. However, how can my code flow through the next <cfcase> such that the result is equivalent to the following PHP code below when variable helpme is either 'a' or 'A': switch(helpme) { case 'a': case 'A': doSomething('a'); break; case 'B': doSomething('b'); break; } - How can I surpress whitespaces such that the resulting HTML code is cleanly formatted? CF is often frustrating because when I need to dynamically set certain HTML attributes, CF inserts large white spaces such that the result looks something like this: <a href=" http://foo.com " > <cfprocessingdirective> doesn't seem to work, even if I've already enabled whitespace suppression in CFIDE. -How can I turn off the ColdFusion equivalent of PHP's register_globals? As a kid who likes to inject MySQL statements in my own scripts to kill time, I'm very concerned that I might forget to use <cfparam> because CF automatically uses the variables even if I don't specify that I passed them using POST or GET. -How can I make a constructor method in ColdFusion components? That's all for now. Thank you very much for your time. [ simon.cpu ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:886 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
