cf16-1代码什么意思

…posted by davidjmedlock:

…由 davidjmedlock 发布

Well, in about 7 hours I’m going to be on a plane to Salt Lake City, Utah for my first snowboarding trip. I’ve never been snowboarding or skiiing, so this should be interesting. I just hope I don’t break any important members. (I can live with a broken leg. A broken arm might impede my ability to code, though, and I don’t think worker’s comp will cover it.)

好吧,大约7个小时后,我将乘飞机前往犹他州盐湖城,这是我的第一次滑雪之旅。 我从来没有滑雪过,所以这应该很有趣。 我只是希望我不要破坏任何重要的成员。 (我可以用断腿的方式生活。但是,断臂可能会妨碍我的编码能力,而且我认为工作人员的助手不会掩盖它。)

Anyway, before I leave Nashville for the weekend, I wanted to post a brief blog on code reuse. I asked a while back what you all wanted to see in my blogs and articles and one reply was that you’d like to see something about creating custom tags. So, here you go. This will be a pretty brief description of how to create a simple tag, but I think you’ll get the point, and I’ll write more on it when I get back.

无论如何,在我周末离开纳什维尔之前,我想发表一个简短的博客,介绍代码重用。 我回想了一阵子,你们都想在我的博客和文章中看到什么,一个答复是,您希望看到有关创建自定义标签的内容。 所以,你去。 这将是关于如何创建一个简单标签的非常简短的描述,但是我想您会明白这一点的,回来时我会在上面写更多的内容。

First of all, any CFM file can be a custom tag. Try the following exercise. Create a file called “customtag.cfm”. Inside that custom tag, do this:

首先,任何CFM文件都可以是自定义标签。 试试下面的练习。 创建一个名为“ customtag.cfm”的文件。 在该自定义标签内,执行以下操作:

#Attributes.Hello#

#Attributes.Hello#

Save it to your web root and then create a file called “tagtest.cfm”. This file looks like this:

将其保存到您的Web根目录,然后创建一个名为“ tagtest.cfm”的文件。 该文件如下所示:

First let’s examine the customtag.cfm file. Notice that we’re parameterizing (is that a word?) the “Attributes.Hello” variable. The attributes scope is generally only available within custom tags and modules, although there are some exceptions which we won’t get into right now. Notice the second line of our “tagtest.cfm” file. We pass in the attribute “Hello”.

首先,让我们检查customtag.cfm文件。 注意,我们正在参数化(是一个词吗?)“ Attributes .Hello”变量。 属性范围通常仅在自定义标签和模块中可用,尽管有一些例外情况我们暂时不讨论。 注意“ tagtest.cfm”文件的第二行。 我们传入属性 “ Hello”。

Also notice the name of the tag we’re calling: cf_customtag. ColdFusion custom tags (not CFX tags) are always called using “cf_” and then the name of the file (excluding the extension). You can then pass any attributes that you want into the tag. These attributes are completely defined by you. Just make sure they follow then naming requirements for ColdFusion variables.

还要注意我们正在调用的标签的名称:cf_customtag。 始终使用“ cf_”,然后使用文件名(不包括扩展名)来调用ColdFusion自定义标签(不是CFX标签)。 然后,您可以将所需的任何属性传递到标签中。 这些属性完全由您定义。 只要确保它们遵循然后命名ColdFusion变量即可。

So you can see here the very basics of custom tags:

因此,您可以在此处查看自定义标签的基本知识:

  • The name of the tag is “cf_” and then the name of the template file标签的名称是“ cf_”,然后是模板文件的名称
  • The attributes specified in the tag called go into the “Attributes” scope available inside the tag template.在称为的标签中指定的属性进入标签模板内可用的“属性”范围。

It’s also important to note that if you move “/tagtest.cfm” to “/test/tagtest.cfm” you will get an error saying that the custom tag template was not found. This is because ColdFusion looks in only certain places for custom tags:

同样重要的是要注意,如果将“ /tagtest.cfm”移至“ /test/tagtest.cfm”,则会收到一条错误消息,指出未找到自定义标签模板。 这是因为ColdFusion仅在某些位置查找自定义标签:

  • The directory that the current template is in.当前模板所在的目录。
  • Any custom tag directories specified in ColdFusion Administrator. This means you can use either the default “ CustomTags” directory or specify that your custom tags are in “C:mytags”. This is done from within the Administrator itself.

    在ColdFusion管理员中指定的任何自定义标签目录。 这意味着您可以使用默认的“ CustomTags”目录或指定您的自定义标签在“ C:mytags”中。 这是在管理员本身内部完成的。

So there’s a start. Next week, we’ll talk about custom tag encapsulation and returning variables from custom tags. In the meantime you can visit CFLib and KodeFusion Scripts for some free custom tags to examine.

所以有一个开始。 下周,我们将讨论自定义标签封装和从自定义标签返回变量。 在此期间,您可以访问CFLib和KodeFusion脚本以获取一些免费的自定义标签进行检查。

翻译自: https://www.sitepoint.com/code-reuse-in-cf-part-one/

cf16-1代码什么意思

cf16-1代码什么意思_CF中的代码重用-第一部分相关推荐

  1. python怎么清除代码_python的shell中的代码怎么清理?

    python shell是Python的命令行. 交互模式下使用Python很方便,如果想清除显示过的信息,有两种方法可以采用. 方法一.针对Python命令行(python shell) 直接使用下 ...

  2. 代码和普通的java_Java中普通代码块,构造代码块,静态代码块区别及代码示例...

    对静态代码块以及构造函数的执行先后顺序,一直很迷惑,看了孙伟琴老师的<java面向对象编程>又结合毕老师的java基础视频中的讲解,现用下面的这段小程序来简明扼要的叙述一下,以加深理解,与 ...

  3. 安卓清理垃圾清理代码_从战中清理代码

    安卓清理垃圾清理代码 从战中清除代码–验证 让我们直接从一个例子开始. 考虑一个简单的Web服务,该服务允许客户向商店下订单. 订单控制器的非常简化的版本可能如下所示– @RestController ...

  4. jupyter输出为html隐藏代码,在jupyter noteb中隐藏代码

    我有一个jupyter笔记本,是降价和代码的混合体.最后,我想把它呈现为一个pdf报告并隐藏代码.我仍然想看到代码的输出,绘图和表格,我只是不想看到最终报告中的代码.我发现下面的帖子有下面的代码,如果 ...

  5. php图片下载代码,php下载css中图片代码

    提供一个常见的php下载css中图片代码,有需要的朋友可以下载,只要把$url填写好就行了哈.  代码如下 复制代码 $host = $host[1]; if (!is_dir('img')) { m ...

  6. vscode中怎样格式化js代码_如何在Visual Studio代码(VSCode)中格式化代码

    回答(30) 2 years ago 对于那些想要自定义要格式化的JavaScript文件的人,可以使用 JSfiles 属性上的任何扩展名同样适用于HTML . { "beautify.o ...

  7. html文档支持代码高亮,为HTML中的代码添加语法高亮

    Hexo 默认对于代码高亮的处理过于粗暴,改变了其原有的 标签形式,而且并没有达到良好的效果,所以尝试自己添加语法高亮功能.此文档也适用于其它HTML文档中代码的语法高亮显示. 我这里使用highli ...

  8. 怎么在html中加代码,如何在HTML中使用代码块

    您可能希望在级联样式表( CSS)中执行此操作.使用您想要的外观创建一些CSS,标记为< code>的内容应该采取那种外观.例如: code { background-color: gra ...

  9. java 注释 代码,如何在Java中注释代码块

    Is it possible to annotate a block of code? E.g. for cycle or simply curly brackets? If so, how? Fir ...

最新文章

  1. linux mint 下载辅助工具,Linux Mint 18.2 下载工具AxeluGet
  2. POJ3133(插头dp)
  3. 高质量c/c++编程(5)
  4. 【2019暑假刷题笔记-树的遍历】总结
  5. centos6查看java命令_centos6.5下常见命令和操作
  6. CSS分别设置Input样式(按input类型)
  7. idea快捷键之记录
  8. jsp - 9 内置对象application详解
  9. Java高并发编程详解系列-线程池原理自定义线程池
  10. 如何修改WSS站点的主菜单
  11. 什么是驻点和拐点_拐点和驻点的区别有哪些
  12. Flash 声音频谱图一
  13. Windows读取NXP MiFare Ultralight C类型NFC卡片的信息
  14. Mac通讯录管理软件BusyContacts安装教程
  15. 微信公众号报错40125
  16. 如何下载3GPP协议
  17. 信息论——JS散度(Jensen-Shannon)
  18. 超人前传第一至十季/全集Smallville迅雷下载
  19. [golang]简单文件上传服务
  20. 通俗的讲,网络爬虫到底是什么?

热门文章

  1. 用C语言写一程序,要求输入平时成绩与期末成绩,可计算出总成绩。(平时成绩占30%,总成绩占70%),要求程序计算出成绩后不退出,可不断输入。
  2. 百度:地震姜常宏,求传播?!! http://t.qq.com/jiangchanghong2016
  3. 以词搜图系统的一个改进版本
  4. rails store
  5. ES查询term的用法
  6. 小白入门区块链技术与应用展望(有参考文献)
  7. php7 一句话木马,PHP一句话木马及查杀
  8. 分布式爬虫(四):大结局
  9. wifi 6、wifi 6e 和 Wi-Fi 7 的区别
  10. 用小乌龟拉取代码_如何使用git拉取代码及提交代码(详细)