+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.

0

Known Issues with Smith

CFML Processors

For now, this entry will serve as a central point for cfopen participants to log issues relating to Smith Project's handling of CFML.

As of this posting the issues I have encountered and since reported to the Smith team:

  • <cfrethrow> tag not supported
  • CreateObject() not supported.  (NEED this!)
  • Application.cfm doesn't seem to be behaving the same as in ColdFusion.  In order to get the Application.cfm code to run I ended up needing to <cfinclude> it at the top of a template. 
  • Custom tag paths are a mystery right now.  No mater what I tried, I couldn't get custom tags to execute.

I have reported all of these issues to Smith via email, and if they hadn't been noted on their forum already, I made note there as well.

If you encounter anything new, please leave a comment here and I will report it to Smith. 

0

CentOS Server (w/GUI) vmware machine now available

Virtual Machines

This won't be the final VM for centOS, I still need to add tomcat as a startup service. But I created the torrent, so if you can download this before I change it feel free.

username: getopen

password: password

root password: password

 

Thanks to Ryan Everhart for hosting the VM for download! 

www.ryaneverhart.com/centOS.tar.gz
 

0

Ubuntu Server vmware machine now available

Virtual Machines

I finally got a good stripped down VM (I hope!) ready for people to try. It has the latest Ubuntu Server distribution (7.04) with the latest Apache (built from source).

I haven't done a ton of testing on it. I have been busy putting the how to's together for both Ubuntu Server and CentOS.

 

EDIT:  Can't get the torrent working right just yet.  Thanks to Ryan Everhart for allowing us to host the VM's on his box.  

www.ryaneverhart.com/UbuntuServer.tar.gz

 

What do we need from you? Please download the torrent and seed it for us! (thats easy right?).

http://www.torrentbox.com/download/109126/ubuntuServer_smithProject.torrent

username: getopen

password: password

root password: password

 

once you boot in, you can log in via command line, and then run the command

startx

If you would like to make this VM more of a desktop, you can run this command in a terminal

sudo apt-get install ubuntu-desktop'

0

cfopen is born

cfopen news

cfopen is born.

In the very near future, we are going to be offering "How To's" on how to set up your very own 100% free and open source CFML stack. If you would like to be a part of the cfopen.com initiative, please contact us here .

We are going to need:

-A hosting option.

-Some developers to help come up with some kind of project directory/index.

-A designer for a cool cfopen.com design.

-A ton of developers writing open source code!

 

tags:
cfopen news

Search