I want to use <cfhtmlhead> in a full script component. But it appears that it has no <cfscript> equivalent.
The CFScript reference is available here.
Is there a work around to use this functionality in a full script CFC?
You would need to write a tag based version that is then included into the script based CFC. I've done this before for things like cfsetting.
Related
Is CFDocument supported in CFSscript specifically with Adobe ColdFusion 2021?
I know that this was not possible in previous versions (but is possible with Lucee). However, I can't find any official documentation either way. I'm hoping someone can point me to any relevant documentation on this.
Thanks!
Yes, it is possible to use cfdocument in cfscript, in ColdFusion 2021.
To be clear, nearly all tags have been supported as cfscript since CF11, released in 2014. Here's the documentation for that from the intro section in the CFML Reference:
As general syntax for script support, a ColdFusion tag is invoked like a function call in CFSCRIPT block with tag name is used for the function name. The tag attributes are passed as comma separated name-value pairs to it, like arguments are passed to a function. The child tag (and the body in general) is defined within a curly brackets, just like a function block.
So as an example, this:
<cfdocument format="pdf">
test
</cfdocument>
could become:
<cfscript>
cfdocument(format="pdf"){
writeoutput("test");
};
</cfscript>
Note how you must use a writeoutput within the body of the document to provide the content of the PDF, even though the cfdocument does not require any corresponding cfoutput. (FWIW, some CFML tags do, like cfsavecontent.) And of course you can use cfdocumentitem, cfdocumentsection, etc. See the docs page about how nested tags are handled in script.
Finally, it's indeed true that Adobe never changed each page of the CFML Reference to indicate a) this change to support all tags as script, nor b) to show using each tag as script.
While it's unfortunate that the CFML Reference is not open source, for us to propose changes, the cfdocs.org site is open source--and I just noticed that their page on cfdocument does not show using it as script, so I will try to offer a PR.
In my project, I have used the function which xaln provided. Now I need to write another function to fix the meta data of the file which is generated by . So the code just like below:
<redirect:write file="file.html">
<xsl:variable name="meta_fix" select="MetaFix:fix(string,string('file.html'))" /> //call the fix function which is an external java function.
However, what i really want is to extend the xalan redirect function and make a customize tag which will be processed just like the
<customize:write file="file.html" fixMeta="t" />
//or
<redirect:customize-write file="file.html" fixMeta="t" />
How can I extend the xalan write function and make the xalan understand my customize tag?
I believe it's possible to plug an Entity Resolver into Xalan which will be able to review and rewrite URIs, which might let you put your hint into the URI rather than a separate flag variable or attribute. Check the documentation on Apache.
Or I suppose you could try copying the logic of redirect: out of the guts of xalan and adapting apprpriately, then plugging it in as an extension element. I don't remember whether extensions would be able to access enough of xalan's guts to make that work, though, and persionally I wouldn't try it since you'd be making your stylesheets extremely nonportable.
Is there any possibility to call some callback function for Debugging purpose before and after the cfinclude tag.
for example if i have
<cfinclude template="xyz.cfm" />
and is Logging is enabled, I would like to call abefoeInclude and afterInclude callbacks.
Is there a possibility to achive this?
You can create your own version of cfinclude as a custom tag http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=reuseCode_2.html
Inside that you can check if debugging is turned on using isDebugMode() and do your logging in side the custom tag. Then you can use the custom tag instead of cfinclude.
I hope that makes sense.
Do you mean whether debugging is enabled? You use the ColdFusion function isDebugMode().
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7bf4.html
I'm looking for a complete list of tags that are not available in ColdFusion 9 script syntax.
Example:
CFSetting: is one example that is available in Railo but not in CF9 for use in cfscript
CFDocument: I can't find this one so far.
Not an official list by any measure, but this is a list I presented to a private forum a while back, and it didn't receive too much correction (and those corrections have been integrated). It was in the context of what CF does and doesn't need to be implemented, to claim 100% coverage in CFScript.
Summary of omissions:
These ones are significant omissions:
<cfcollection>
<cfexchangecalendar>
<cfexchangeconnection>
<cfexchangecontact>
<cfexchangefilter>
<cfexchangemail>
<cfexchangetask>
<cfexecute>
<cfindex>
<cfinvoke> (support for dynamic method names)
<cflogin>
<cfloginuser>
<cflogout>
<cfmodule>
<cfoutput> (implementation of query looping with grouping)
<cfparam> (fix the bug in that enforced requiredness doesn’t work (ie: param name="foo";))
<cfsearch>
<cfsetting>
<cfwddx>
<cfzip>
<cfzipparam>
There’s a reasonable case for these ones to be implemented:
<cfassociate>
<cfcache>
<cfcontent>
<cfflush>
<cfhtmlhead>
<cfheader>
<cfntauthenticate>
<cfprint>
<cfschedule>
<cfsharepoint>
These ones... I’m ambivalent:
<cfgridupdate>
<cfinsert>
<cfobjectcache>
<cfregistry>
<cfreport>
<cfreportparam>
<cftimer>
<cfupdate>
We don’t need these ones at all, I think:
<cfajaximport>
<cfajaxproxy>
<cfapplet>
<cfcalendar>
<cfchart>
<cfchartdata>
<cfchartseries>
<cfcol>
<cfdiv>
<cfdocument>
<cfdocumentitem>
<cfdocumentsection>
<cffileupload>
<cfform>
<cfformgroup>
<cfformitem>
<cfgraph>
<cfgraphdata>
<cfgrid>
<cfgridcolumn>
<cfgridrow>
<cfinput>
<cflayout>
<cflayoutarea>
<cfmap>
<cfmapitem>
<cfmediaplayer>
<cfmenu>
<cfmenuitem>
<cfpod>
<cfpresentation>
<cfpresentationslide>
<cfpresenter>
<cfselect>
<cfsilent>
<cfslider>
<cfsprydataset>
<cftable>
<cftextarea>
<cftextinput>
<cftooltip>
<cftree>
<cftreeitem>
<cfwindow>
If there's anything here that you think ought to be included in CFScript, please raise an issue here - http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html - and cross reference the issue number here.
HTH.
I would argue that there are no commands that are not available as script as you can extend and write the missing bits using cfc's.
Thus wrap your favourite missing <cftag in a cfc and call it using new
However, here is a list of what is supported
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSe9cbe5cf462523a02805926a1237efcbfd5-7ffe.html
My data coming from the database might contain some html. If I use
string dataFromDb = "Some text<br />some more <br><ul><li>item 1</li></ul>";
HttpContext.Current.Server.HtmlEncode(dateFromDb);
Then everything gets encoded and I see the safe Html on the screen.
However, I want to be able to execute the safe html as noted in the dataFromDb above.
I think I am trying to create white list to check against.
How do I go about doing this?
Is there some Regex already out there that can do this?
Check out this article the AntiXSS library is also worth a look
You should use the Microsoft AntiXSS library. I believe the latest version is available here. Specifically, you'll want to use the GetSafeHtmlFragment method.