+1

HOW TO: Create Custom Tags in Smith Project

Smith Project

In my first go-round of testing with Smith Project I encountered some issues creating custom tag mappings. It looks like they have that resolved in a recent release of Smith Project.

smithos.svn.sourceforge.net/viewvc/smithos/docs/howto-create-a-custom-tag.txt

    1 This HOWTO shows you how to create a custom tag in Smith.
    2 
    3 
    4 STEP ONE - create a custom tag.
    5 
    6 In this howto, I am using the Smith bundle on my Windows machine and I will
    7 create file "C:/smith-bin-windows-1.3b5/wwwroot/WEB-INF/customtags/mytag.cfm"
    8 with the following contents:
    9 - - - - - - - - - - - - - - - - - - - - - - - - - - -
   10 <cfparam name="attributes.greet" default="John Doe">
   11 
   12 <!--- show all received attributes --->
   13 <cfdump var="#attributes#">
   14 
   15 <InvalidTag>
   16     <cfoutput>
   17         alert('Hey, #attributes.greet#!');
   18     </cfoutput>
   19 </script>
   20 - - - - - - - - - - - - - - - - - - - - - - - - - - -
   21 
   22 
   23 STEP TWO - Register the path to custom tag in Smith Administration.
   24 
   25 - Login to Smith Administration (http://localhost:8081/IDE/admin.html).
   26 - Select "Custom Tags" in the menu, then in the "Tag Directory Path" field,
   27   type absolute path to directory where your custom tag resides. In my case,
   28   that is (without quotes):
   29       "C:/smith-bin-windows-1.3b5/wwwroot/WEB-INF/customtags"
   30   [Note: you should use forward slashes (/)! Up to version 1.3b5, Simth had
   31   a bug and failed if you used backslashes! This is corrected in SVN and
   32   will be included in the next build]
   33 - When finished, click "Add path" button and the path will show up in the
   34   table below.
   35 
   36 
   37 STEP THREE - Create a test page and run the tag.
   38 
   39 In this example, I will create file
   40     "C:/smith-bin-windows-1.3b5/wwwroot/tagtest.cfm"
   41 with the following contents:
   42 - - - - - - - - - - - - - - - - - - - - - - - - - - -
   43 <html> This is a custom tag test.
   44 
   45 <!--- reserved attributes names: "name", "template", "attributecollection" --->
   46 <cf_mytag greet="Superman" name="this does not get passed to mytag.cfm!">
   47 - - - - - - - - - - - - - - - - - - - - - - - - - - -
   48 
   49 - Start the server by running  C:/smith-bin-windows-1.3b5/startweb.bat
   50 - Open the test page in a web browser  http://localhost:8081/tagtest.cfm
   51 
   52 
   53 SUMMARY
   54 
   55 a) name of the new tag is 
   56     "<CF_" + custom-tag-file-name-without-.cfm-extension + attribute-list + ">"
   57    Note: If you end the tag with ">" it is called only once. If you end the
   58    tag with "/>", it is called twice, once for the start/opening tag, and
   59    once for the end/closing tag.
   60 b) in custom tag implementation, you receive the attributes through the
   61    "attributes" scope. Note: If you take a look at implementation of
   62    CfmoduleTagHandler.translate() method, you will notice that there are
   63    some reserved attribute names: "template", "attributecollection" and
   64    "name". Currently, these attributes are not passed to the custom tag
   65    implementation, but if required, this should be easy to fix.

 



Smith is an open source, cross-platform ColdFusion® engine, written entirely in Java. Running on top of Java Runtime Environment and Java Servlet Container, it can be virtually deployed on any operating system and work with any web server. Smith represents lightweight, yet reliable alternative to the existing ColdFusion® servers. It supports most important ColdFusion® features (see Features) and already drives several large ColdFusion® applications.

 
Anybody using this platform?

--
http://www.miamiwebdesign.com
 
posted 271 days ago
Add Comment Reply to: this comment OR this thread
 
WOW gold said:
 
 
posted 199 days ago
Add Comment Reply to: this comment OR this thread
 
WOW gold said:
 
 
posted 199 days ago
Add Comment Reply to: this comment OR this thread
 
profit from baccarat said:
 
Awesome. just awesome...i haven't any word to appreciate this post.....Really i am impressed from this post....the person who create this post he is a great human..thanks for shared this with us http://www.winning-baccarat-tips.com">profit from baccarat
 
posted 165 days ago
Add Comment Reply to: this comment OR this thread
 
sites to play free bingo said:
 
i found this informative and interesting blog so i think so its very useful and knowledge able.I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me.Really the blogging is spreading its wings rapidly....
http://www.playtopbingo.com
 
posted 165 days ago
Add Comment Reply to: this comment OR this thread
 

Search