Simon Cornelius P. Umacob wrote:

>- 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;
>}
>  
>
If you use <cfscript> for your switch/case rather the tags you can 
replicate your PHP code pretty much verbatim.

>- 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:
>  
>
OK - there are a number of ways to do this. 
Check out the <cfsetting> tag, which can be placed around code so that 
only code wrapped in cfoutput will be output.
Also there is <cfsilent> which will stop any and all output.

><a href="
>
>
>
>
>http://foo.com
>
>                                 "
>                >
>  
>
By the looks of this I would suggest that you try to seperate your logic 
and display code much more.  Generate a variable with the link details 
and output that, rather than including a bunch of conditions within your 
display code for the link. eg.

<cfsilent>
<cfif variables.thisval eq  1>
    <cfset variables.link = "http://foo.com/";>
<cfelse>
    <cfset variables.link = "http://foo2.com/";>
</cfif>
</cfsilent>
<cfoutput><a href="#variables.link#"></cfoutput>

>-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.
>  
>
Well the point of <cfparam> is to ensure that variables are defined and 
if not to give them a default value.  If you cfparam a form or url scope 
variable, then your code will not be able to tell the difference between 
whether it was added in the code or passed through a form submission or 
url params. 

To be honest, SQL injection via form and url variables is a really bad 
practice to get into.  The security risk of leaving it in the production 
application and getting your data trashed is very high, so don't do it. ;o)

>-How can I make a constructor method in ColdFusion components?
>  
>
http://cfdj.sys-con.com/read/42077.htm should give you the information 
you need about CF components.

Hope this helps

Regards

Stephen


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get Instant Hacker Protection, Virus Detection, Antispam & Personal Firewall.
http://www.houseoffusion.com/banners/view.cfm?bannerid=62

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:887
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

Reply via email to