symphony

Integrating and maintaining a calendar of events within the Symphony CMS

Stamped: 03 May 2011 | Show comments

Calendar XSLT Utility

Symphony doesn't easily offer a way to integrate a calendar of events into an existing setup, so I've come up with an XSLT Utility to make it a little easier.

After having to revisit a calendar of events and kind of hacking my way through it originally, I've come up with another way to incorporate an event calendar more easily into an existing site. A very simple example is hosted here. The source is available at github. If you have any issues, please discuss them at github or at the Symphony forums: http://symphony-cms.com/discuss/thread/66262/.

Requirements:

  1. Nils' Date and Time Field Extension - Because it uses a nice interface and allows for easier management of events; make sure to take the experimental branch.
  2. This event I created, found on github, placed in your workspace/events folder.
  3. A section to handle all the events with a single Date & Time field, it must contain at least one other field, like name, description, etc. But you can have as many as you like. They will all be displayed, and can be disabled by using CSS display:none; on the <li>. For example, if we had a field called description it would be produced as <li class="description">, so .description { display: none; } would get rid of it.
  4. Attach the event to whatever page you want to display the calendar on.
  5. Attach a data-source pulling whatever events you wish, you can limit it by date to reduce the amount of entries, but do not change the grouping.
  6. Finally, in the page you wish to drop the calendar in, the php xmlns must be added to the <stylesheet> tag, and the function to generate the calendar must be used. An example page would look like is below. The second parameter next to the function is the name of the data source. The third is an optional path to link to the event by id so you provide the root path (if none is provided it will just be listed as text). The fourth is an optional class to provide the table with, the default is calendar.
      <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:php="http://php.net/xsl">

        <xsl:import href="../utilities/master.xsl"/>

        <xsl:template match="/data">

        <h1><xsl:value-of select="$page-title"/></h1>
        <xsl:value-of select="php:function('generate_calendar', 
          calendar-main-events, concat($root,'/calendar/event'), 
          'calendar')" disable-output-escaping="yes"/><br />
        </xsl:template>
        </xsl:stylesheet>

Bugs/features:

  1. It's not possible to have a date field in the same section you plan to use for the events, it conflicts with a date time field.
  2. If you have two calendars on the same page, when you switch months/years, it will switch them on both calendars.

You can download it at my Github repo.

tags: symphony, symphony extension, portfolio

When should I use Ruby on Rails, or something else? (Comparing Symphony and Rails)

Stamped: 18 Oct 2010 | Show comments

When beginning a new project, the first thing I come across is what software/language/methodology do I use to complete the project? The answer is quite simple, it depends.

Oh, you clever chap, what a cheeky answer

The truth of that matter is, it does depend solely on your application requirements and your knowledge of what's available. Nearly 90% of the time in my situation, it either comes down to either of two things:

The other 10% of the time I use my own solution, as in SAMOS, but that's for another day.

Both Rails and Symphony subscribe to a Model-View-Controller (MVC) architectural software design methodology. Rails treats the methodology quite literally, while Symphony does so a little more loosely. The nomenclature in each are as follows:

RailsSymphony
ModelModelSection
ViewViewPages
ControllerControllerData-Sources/Pages/Components

I won't really describe rails much, because there's plenty of information about it. A great place to start is here: http://edgeguides.rubyonrails.org/getting_started.html.

Then I'll go somewhere else!

However, Symphony could use some explanation. Symphony's models are called sections (which contain many fields, just like fields in a database), and they are just like rails models. It's views are controlled by pages, and it's controllers are controlled (hah!) by data-sources, pages, and components. While that may be a little confusing, it works quite wonderfully.

Pages control what gets output as HTML, but you can also include logic in them, just like Rails does with ERB/HAML. However, a best practice is to stub out a lot of the logic into components (templates) to make it more DRY.

Data-sources are the link between the pages/components and the sections/fields. In rails, this would be the ActiveRecord interface. They grab data in a certain way based on lots of different things in lots of different ways. I couldn't be more vague, I know.

Components are similar to helpers/partials in rails, where you can lump similar things together so you can reuse them.

Go on then, answer the original question

How I decide which to use basically involves me looking at this table and deciding how I feel like torturing myself for that certain project. Most of the time the biggest issues are whether or not it contains a lot of logic that needs to be tested, and which template language I want to use.

'
RailsSymphony
Testable?Yes, I use BDDNot so much
Template LanguageERB/HAMLXSLT (this is quite amazing)
GUINopeYes, you can see an example here
OutputHTML/XML/JSON/etcHTML (as xml), JSON
DatabaseEverything you can throw at itMySQL
Hosted at Godaddy?FMLDIAF

There are a couple other things to compare, but these are often the most important.

Great! Losing patience, how do you decide?

If it's more of a web application and not as much as website, I often use rails, because they usually involve logic that should be tested.

The template language shouldn't be, but is a huge issue to a shallow individual such as myself. You can do exactly the same stuff in both ERB/HAML and XSLT. They both have their advantages and disadvantages. ERB/HAML's main pro going for is that it's easy to use and quite succinct. XSLT's plus is that it's XSLT and lets you traverse data (XML) in such an amazing way, but it comes at price, it's quite verbose and ancient (it's from 1999). For me? It depends, again, and how bored I am with one over the other.

Whether or not I need Symphony's GUI is also another important issue. If I don't feel like building an interface and using the default Symphony UI for tech-savvy clients I will often choose this (though you can also make your own interface as well).

Once again, if it's more of web app, I'll often use rails because I might need an API (where I might need to output XML/JSON) right away, or at some point in the future. In Symphony, you can output XML right out of the box, and can create a REST API, but the CUD part of CRUD is a little harder to manage in symphony this way.

The database usually isn't as huge issue, and mainly depends on where the app/site is being hosted. Symphony currently only supports MySQL, but nearly every host supports MySQL, so whatever!

And there you have it, it simply depends, on... lots of stuff. </shill>

tags: rails, symphony, development

Keep Flippin' website v3

Stamped: 15 Jun 2009 | Show comments

keep flippin picture

New Hotness (updated)

I've recently changed the Schedule page, and a hidden, non-publicly page, to use a Rails Application as a 'data-source' to provide the Schedule of classes, as well as other stuff on that non-public page. This was done in an effort to help ease the transition between the software that Keep Flippin' currently uses to manage itself, and the new software I will be writing. More will follow in the coming months!

Old and Busted (original)

Below this is all tech-talk. To summarize, I used new stuff to make the site better, make it quicker, and more responsive. This is what I made.

The new keep flippin website is built using compass for the CSS (this is amazing), symphony, some extensions I created, SASS, XSLT and GitHub to keep track of everything.

tags: keep flippin, portfolio, symphony

Dealing with database concurrency (locking) in the Symphony CMS

Stamped: 13 Jun 2009 | Show comments

picture of it

Symphony doesn't natively supported pessimistic database locking, so I created an extension in symphony to handle it, both in the backend and the frontend. It's somewhat complicated to implement, but so far it works pretty great. I created it because one of the next big projects I'm working on will be used by many people at once, and I was considering using symphony to create it, as opposed to Rails.

You can get it here.

Report any issues at GitHub.

tags: symphony extension, symphony, concurrency

Uploading multiple files with Symphony CMS

Stamped: 01 Jun 2009 | Show comments

Mass Upload Utility

Many CMS' don't offer a way to manage picture galleries easily, and neither does symphony out of the box. But, after playing with symphony some, I decided that I liked it and the next project I would do would be with symphony.

So I created a plugin (in symphony: extension) that allows you to upload multiple files, and create entries (in this example, gallery items, or rows in the database, etc) to allow you to accomplish this easily.

You can download it at my Github repo.

tags: symphony, symphony extension, portfolio

Symphony CMS

Stamped: 28 May 2009 | Show comments



I've been working on moving this to this. It's got a bit of a learning curve, but I would say it's like Rails for designers with a GUI. That's not a bad thing. The bad thing is that it uses XSLT 1.0. Which is the least powerful language ever written (spec was written 8 years ago). It's not a procedural language, and if you don't treat it as one, you'll be ok.

Some posts about tutorials will follow.

tags: symphony
recent entries
Rails — A faster way for next and previous links on a post, article, or any model
The awkward things Siri says
Node.js — Getting oAuth Up and Running Using Express.js and Mongoose
Node.js — Getting oAuth Up and Running Using Express.js, Railway.js and Mongoose
Migrating from Rails 3.1 RC4 to RC5 using Heroku's Cedar Stack (also compass, unicorn, and sendgrid)
Random Freeze Fix for GTX 460 in 10.6 (osx86)
Wasted on Steam - an analytic tool for the Steam platform
Rails 3.1 — SQL logging to STDOUT during testing (with rspec, test::unit, or cucumber)
Rails 3.1 — Using ERB/HAML/etc within a Coffeescript JS file
Rails 3.1 — 'load_missing_contant': Expected ... to define ... (LoadError)
View the entire archive of articles