SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    learning CFFunction

    I am at http://livedocs.adobe.com/coldfusion...talling_1.html for learning cfunction tags

    (1) Since I don't understand it I like to know where I can see about more simple CFFunction.



    (2) What is different from CFFunction and CFComponet?

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) The link you posted is about installing ColdFusion. Start with the section on cffunction and cfcomponent
    http://livedocs.adobe.com/coldfusion...talling_1.html


    2) Loosely put, a cffunction is a block of code that performs a task. A component is an object that can contain many cffunctions.

  3. #3
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cfStarlight View Post
    1) The link you posted is about installing ColdFusion. Start with the section on cffunction and cfcomponent
    http://livedocs.adobe.com/coldfusion...talling_1.html
    Sorry I meant that Installing ColdFusion > CFML reference > ColdFusion TAGs > CFFunction.


    2) Loosely put, a cffunction is a block of code that performs a task. A component is an object that can contain many cffunctions.
    Ah, cfc is more wider than cffunctions. Thank you.

  4. #4
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Aberdeen, Scotland
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's worth noting that CFCs are only available from version 6 of ColdFusion and above.

  5. #5
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Clarkee21 View Post
    It's worth noting that CFCs are only available from version 6 of ColdFusion and above.
    Ah, Thank you.

    My ColdFusion is above 6.


    By the way, I made code2 from code1.
    But Both code1 and code2 fails to replace '& middot' to 'my_middot' which is in a form.myText.
    Code:
    code1
    
    <cffunction name="HtmlUnEditFormat" access="public" returntype="string" output="no" displayname="HtmlUnEditFormat" hint="Undo escaped characters"> 
          <cfargument name="str" type="string" required="Yes" /> 
          <cfscript>
             var lEntities = "&##xE7;,&##xF4;,&##xE2;,&Icirc;,&Ccedil;,&Egrave;,&Oacute;,&Ecirc;,&OElig,&Acirc;,&laquo;,&raquo;,&Agrave;,&Eacute;,&le;,&yacute;,&chi;,&sum;,&prime;,&yuml;,&sim;,&beta;,&lceil;,&ntilde;,&szlig;,&bdquo;,&acute;,&middot;,&ndash;,&sigmaf;,&reg;,&dagger;,&oplus;,&otilde;,&eta;,&rceil;,&oacute;,*,&gt;,&phi;,&ang;,&rlm;,&alpha;,&cap;,&darr;,&upsilon;,&image;,,&rho;,&eacute;,,&lt;,&cent;,&cedil;,&pi;,&sup;,&divide;,&fnof;,&iquest;,&ecirc;,&ensp;,&empty;,&forall;,&emsp;,&gamma;,&iexcl;,&oslash;,&not;,&agrave;,&eth;,&alefsym;,&ordm;,&psi;,&otimes;,&delta;,&ouml;,&deg;,&cong;,&ordf;,&lsaquo;,&clubs;,&acirc;,&ograve;,&iuml;,&diams;,&aelig;,&and;,&loz;,&egrave;,,&amp;,&nsub;,&nu;,&ldquo;,&isin;,&ccedil;,&circ;,&copy;,&aacute;,&sect;,&mdash;,&euml;,&kappa;,&notin;,&lfloor;,&ge;,&igrave;,&harr;,&lowast;,&ocirc;,&infin;,&brvbar;,&int;,&macr;,,&curren;,&asymp;,&lambda;,&frasl;,&lsquo;,&hellip;,&oelig;,&pound;,&hearts;,&minus;,&atilde;,&epsilon;,&nabla;,&exist;,&auml;,&mu;,,&nbsp;,&equiv;,&bull;,&larr;,&laquo;,&oline;,&or;,&euro;,&micro;,&ne;,&cup;,&aring;,&iota;,&iacute;,&perp;,&para;,&rarr;,&raquo;,&ucirc;,&omicron;,&sbquo;,&thetasym;,&ni;,&part;,&rdquo;,&weierp;,&permil;,,&sigma;,&sdot;,&scaron;,&yen;,&xi;,&plusmn;,&real;,&thorn;,&rang;,&ugrave;,&radic;,&zwj;,&there4;,&uarr;,&times;,&thinsp;,&theta;,&rfloor;,&sub;,&supe;,&uuml;,&rsquo;,&zeta;,&trade;,&icirc;,&piv;,&zwnj;,&lang;,&tilde;,&uacute;,&uml;,&prop;,&upsih;,&omega;,&crarr;,&tau;,&sube;,&rsaquo;,&prod;,&quot;,&lrm;,&spades;";
             var lEntitiesChars = "&#231;,&#244;,&#226;,&#206;,&#199;,&#200;,&#211;,&#202;,Œ,&#194;,&#171;,&#187;,&#192;,&#201;,?,&#253;,?,?,?,Ÿ,?,?,?,&#241;,&#223;,„,&#180;,&#183;,–,?,&#174;,‡,?,&#245;,?,?,&#243;, ,>,?,?,?,?,?,?,?,?,&#179;,?,&#233;,&#185;,<,&#162;,&#184;,?,?,&#247;,ƒ,&#191;,&#234;,?,?,?,?,?,&#161;,&#248;,&#172;,&#224;,&#240;,?,&#186;,?,?,?,&#246;,&#176;,?,&#170;,‹,?,&#226;,&#242;,&#239;,?,&#230;,?,?,&#232;,&#190;,&,?,?,“,?,&#231;,ˆ,&#169;,&#225;,&#167;,—,&#235;,?,?,?,?,&#236;,?,?,&#244;,?,&#166;,?,&#175;,&#189;,&#164;,?,?,?,‘,…,œ,&#163;,?,?,&#227;,?,?,?,&#228;,?,&#188;, ,?,•,?,&#171;,?,?,€,&#181;,?,?,&#229;,?,&#237;,?,&#182;,?,&#187;,&#251;,?,‚,?,?,?,”,?,‰,&#178;,?,?,š,&#165;,?,&#177;,?,&#254;,?,&#249;,?,?,?,?,&#215;,?,?,?,?,?,&#252;,’,?,™,&#238;,?,?,?,˜,&#250;,&#168;,?,?,?,?,?,?,›,?,"",?,?";
          </cfscript>
          <cfreturn ReplaceList(arguments.str, lEntities, lEntitiesChars) /> 
       </cffunction>
    #HTMLunEditFormat(form.myText)#
    
    code2
    
    <cffunction name="HtmlUnEditFormat" access="public" returntype="string" output="no" displayname="HtmlUnEditFormat" hint="Undo escaped characters"> 
          <cfargument name="str" type="string" required="Yes" /> 
          <cfscript>
             var lEntities = "&middot;";
             var lEntitiesChars = "my_middot";
          </cfscript>
          <cfreturn ReplaceList(arguments.str, lEntities, lEntitiesChars) /> 
       </cffunction> 
    
    #HTMLunEditFormat(form.myText)#
    <cfoutput>
    Do you see what's wrong in my applying the CFfunction above ?

    (The code1 is from http://www.coldfusionjedi.com/forums...3F5726B8607FD8 .)

  6. #6
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look for the simple/obvious problems first.

    1) You will have to examine your input value. Does it acutally contain the sequence of characters you are trying to replace?
    2) Is it in the same case, because according to the documentation ReplaceList is case sensitive.

  7. #7
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cfStarlight View Post
    Look for the simple/obvious problems first.
    Yes, I need it.


    Quote Originally Posted by cfStarlight View Post
    1) You will have to examine your input value. Does it acutally contain the sequence of characters you are trying to replace?
    The following code contains & middot(). It actually has only & middot().

    Quote Originally Posted by cfStarlight View Post
    2) Is it in the same case, because according to the documentation ReplaceList is case sensitive.
    Does & middot() has Case?




    Code:
    <cffunction name="HtmlUnEditFormat" access="public" returntype="string" output="no" displayname="HtmlUnEditFormat" hint="Undo escaped characters"> 
          <cfargument name="str" type="string" required="Yes" /> 
          <cfscript>
             var lEntities = "&middot;";
             var lEntitiesChars = "my_middot";
          </cfscript>
          <cfreturn ReplaceList(arguments.str, lEntities, lEntitiesChars) /> 
       </cffunction> 
    
    <cfoutput>
    
    <form action='test.cfm' method='post'>
    <textarea name='myText'><cfif isDefined('form.myText')>#trim(form.myText)#<cfelse></cfif></textarea> 
    <input type='submit' value='submit'>
    </form>
    
    <cfif isDefined('form.myText')>
    #htmlUnEditFormat(form.myText)#
    </cfif>
    </cfoutput>
    You can see the code above doesn't replace & middot() at http://dot.kr/x-test/test.cfm

  8. #8
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It actually has only & middot().
    You have to check the value of form.myText _after_ the form is submitted. That is debugging 101 and the first thing you should have done. Does it contain the literal string "& middot"? Not the charcter - that literal string. If it does not, then obviously your function will do nothing. Which is correct.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •