Home
Username:
Password:
ColdFusion MX 7 Advanced Tutorials

Custom Tags / CFMODULE




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

As I mentioned in the how to call a custom tag movie we can use the CF module tag. So we're going to look at this second example withIn this movie, so I'm going to move out to the CF module dot CFM page to move into it. But if you use the name attribute for your custom tag template in the CF module call its going to be looking for your custom tag template in the custom tags folder. If you cannot access that folder then you'll want to use the template attribute for that call and using that you can put it outside the custom tags folder. So in other words using the template attribute you can put it anywhere in your website. So let's move out to looking at that specific call and this explains it just a little bit in further detail. So the CF module tag is a good method to use if you can't access the custom tags folder, you can't get to the ColdFusion administrator or you plan on calling the tag dynamically. So there are two attributes and these or in either or. So you use either name or template. If you specify the template attribute you can use a relative path to a custom tag template or you can use a ColdFusion mapping. If you use the name attributes, ColdFusion will look for this tag template in the custom tags directory. You need to put the full path to the template using dot notation starting from the custom tags folder. So if the custom template was located in the Suma folder so inside our custom tags folder we put a Suma folder and inside of that I have the tag, what I would do is put this as our name attribute and that would give it the path, using dot notation. You don't use the dot CFM as you've seen in either one of these when you get the name attribute. So let's move into code view and we'll take a look at this. Now I'm using the template attribute so I can use a relative path just like we talk about up here, use a relative path if your using the template. So I've got that set up, I simply use the CF module template equals whatever our custom tag template is. I also put the countries tag on here as well with a call to that, so let's go out and take a look at this page and I've called the tours custom tag so here's the listing of our tours and I've called the country custom tag user listing of our countries. Let's modify this just a little bit and what I will do is move this comment up in front of here and I will uncomment out the tour id attribute for the tours, I'll do the same thing here so I'll just take this and move this up and we'll take the opening comment and move it over here. So now we have a tour id being passed, so you simply list the attribute as an attribute of CF module, unlike the other syntax where the CF underscore tours in this example to our id would be an attribute of that. So we'll save this page, preview it and we should see the exact same thing but we have filtered our tour based on the id being passed in for our tours and the id being passed in for the country. So those are the two ways to call a custom tag, how to create a custom tag and information about why to use one and what a custom tag is within this section of movies. The last type of reusable code we'll be looking at within this course is the CFC type of reusable code so make sure you look at that movie.

Tutorial Information

Course: ColdFusion MX 7 Advanced
Author: Candyce Mairs
SKU: 33828
ISBN: 1-934743-34-8
Release Date: 2007-11-30
Duration: 6 hrs / 89 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available