Integrate FCK Editor into Typo Blog

Categories: Uncategorized

Well, after much avail, my blog is back up and running.  I upgraded to Typo 4.0.3, along with ruby to 1.8.5 and rails to 1.1.6 and loving it.  Going from Typo 2.6.0 to 4.0.3 is a pleasant migration, and well worth the effort.  The backed is cleaned up, easier to manage, and includes many new features and sidebars.

So, while I was doing all of this I decided to integrate the popular FCK Editor.  This is a quick overview of what I did:

1.  Copy the fckeditor.js, fckconfig.js, fcktemplates.xml, fckstyles.xml files into your {typo directory}/public/javascripts folder.
2.  Change the location of FCKeditor on line 33 of fckeditor.js to ‘javascripts’:

[-]View Code COLDFUSION
1
this.BasePath = '/javascripts/' ;

2.  Place the editor folder into the public/javascripts folder as well.
3.  Configure FCK Editor to suit your needs and your server environment.  There is plenty of documentation on this, so I won’t go into any details here.
4.  Add the javascript include tag into app/views/layout/administration.rhtml, like so:

[-]View Code COLDFUSION
1
<%= javascript_include_tag "fckeditor" %>

5. Define a helper to create the FCK editor text area field in the app/helpers/application_helper.rb file:

[-]View Code COLDFUSION
1
2
3
4
def fckeditor_text_field(object, method, options = {})
text_area(object, method, options ) +
javascript_tag( "var oFCKeditor = new FCKeditor('" + object + "[" + method + "]');oFCKeditor.ReplaceTextarea()" )
end

6. Call the fckeditor_text_field helper within your app/views/admin/content/_form.rhtml file:

[-]View Code COLDFUSION
1
<%= fckeditor_text_field( "article", "body") %>
Read More

Programmatically manipulate function arguments in ColdFusion

Categories: Uncategorized

Coldfusion is an extremely powerful programming language, especially it’s use of scoped variables and structures (or Associative Arrays).  This is especially true of the arguments scope within a cffunction.  The arguments scope is a struct that with the key equal to the argument’s name attribute, and the value is arguments current value.  Pretty simple huh?

Well, this lets us do all sorts to cool things.  I wanted to work with the arguments listing of a function programmatically, by looping through the arguments struct and assigning their values into another struct to be used throughout the component:

<cfscript>
//loop through arguments and setup this.personprofile object (dont include formscope,eventcode,showalum args)
args = structcopy(arguments);
structdelete(args,"formscope");
structdelete(args,"eventcode");
structdelete(args,"showalum");
argnames = structkeyarray(args);
for (i=1;i lte ArrayLen(args); i=IncrementValue(i)){
    this.personprofile[argnames[i]] = args[argnames[i]];
}
</cfscript>

As you can see from this example, its relatively easy to work with the arguments to a function in coldfusion.

Let me explain what is going on here.  As you can see in the comment, I have several (3 to be exact) arguments that I don’t want to inject into my personprofile structure.  To avoid this, I put these 3 arguments at the end of the argument listing for the function. 

First, I copy the arguments struct to the args variable.  Keep in mind, that when you perform a structcopy, it copies all simple values but any nested complex variables (strucs, arrays, queries) are copied by reference (so if you change the value in the copy, it will be changed in the original).  Therefore, before this code block, I copy the formscope, eventcode, and showalum variables into the this.formscope, this.eventcode, and this.showalum variables respectively (to be accessed throughout the component).  Then, I delete the un-needed arguments from the args struct so that they are not included in my new struct.

Secondly, I use the function StructKeyArray to get an array of the structure’s keys, in order to assign these same key values into my other struct.  Then, I loop over my args variable (notice I can treat the arguments struct as an array as well), and assign the name/value pairs of the argument structure into my existing structure.  Pretty simple and rather straight-forward.

For more info about the arguments scope, refer to Working with arguments and variables in functions on Adobe’s Coldfusion documentation site.

Read More

Trends in web design

Categories: Uncategorized

    Maybe its just me, but I think the Design of the Web is improving.  Whether it is becuase of new technologies such as AJAX, powerful frameworks such as Ruby on Rails or CakePHP, or it is just simply due to the realization of what the everyday -average- user wants.
   
    Simple is in, and thank God!  Web Sites of the past have been cluddered with obtrusive ads, annoying popups, bad color schemes, and poor graphics.  I think we are moving in the right direction.  Being a fan of Google (did you notice??), maybe they deserve a ‘pat on the back’ for, perhaps pioneering, and definitely showing the attractive nature of keeping things simple, easy to use and understand, and yet extremely powerful.

    Getting to the point, I think that Web Design from Scratch has a great article on the Current style in web design, pointing out what is hip in web design today.  They focus on:

   
    The page also highlights some of the best current designed web sites out there today, including:

Read More

Google gadgets for your site

Categories: Uncategorized

Google has launched their ‘Google gadgets for your webpage‘ service.  This allows you to add any number of the google portal gadgets to your web site or Blog.  Sounds like it would be difficult right?  Nope.  Google provides the code, you just copy and paste it into your Blog’s administrative backend or your web site’s HTML.  You can even specify options for each gadget, like the following capture of the Google Calendar:

BTW, I realize that this site has not been updated in quite a long time.  I am going to try to dedicate some of my precious time on this planet to providing you with more useless information that spews from my brain.
Read More