Archive for the ‘Coding’ Category

Creating an administration area

Thursday, May 6th, 2010

I’ve been hard at work, and I think I have the first iteration of the database schema ready to start building around. I’m planning to start with the administration portion, because without it, I don’t have any content to display on the front end at all. Sort of a Data / Logic / Presentation thing I think.

wordpress dashboard Creating an administration areaThe administration area needs to be familiar to people. I like both WordPress’ and CMS Made Simple’s, because it splits the different things you need to manage into identifiable categories and you have a very good idea of where to find everything just by looking at the “Admin Home Page.” What I’d like to do a little different is multi-tasking. At the moment, you can only be on one page at a time, something that irks me greatly when I’m trying to put together a site in either system. If I’m trying to edit templates and style sheets at the same time so that I can get a site out the door, at the moment I’m stuck switching between tabs/windows. What I really want is the ability to have separate, what I’m going to call, “Panes,” so that when you click a menu item it opens in the browser window, but if you click another menu item it opens another “Pane,” that’s not an actual new browser window or tab, but a new frame within the same browser tab.

This way, you can open multiple Panes in a window, and be working on different things in the system, all independent of one another, but still in one place where you can see them all.

Of course, this will not be developed right away. I need to put together an Ajax framework for it to happen, and I’m more concerned with being able to manage putting stuff into the database than making it pretty and user-friendly. There will come a time for GUI design, though, and I always like brainstorming how friendly I’d like it to be from an early stage, because it will affect how I build the system .

Build out an existing CMS, or create my own?

Thursday, April 29th, 2010

There’s a lot to be said for Open Source. To be able to deploy a website on a CMS like WordPress or CMS Made Simple is pretty awesome. Even better, if you have a paying client that will allow you to use one of them to build their website on top of one of these great systems.

Something on my mind lately though is the fact that I’m trying to grow as a programmer, and one of the things I feel an experienced programmer needs to have is software he or she has created. Sort of like designers with their portfolios, good programmers should be able to call upon their own library, in more ways than I call on some generic stylesheets I’ve created in the past in order to build sites faster.

I started to create a CMS a couple of months ago, and paying projects got in the way. However, at this time I’m trying to free myself up, dust it off, and continue with it. Right now, it feels like something too big for me. On the other hand, I’m trying to grow, right? Shouldn’t it feel bigger than what I can do, so that I go out and learn what I need to know to make this happen?

HTML Tidy

Friday, February 12th, 2010

Today is apparently Web Developer Tools day.

Ever copy and paste from Work or Outlook, put it online, and have someone call you screaming about “weird characters”?

This is because Microsoft like to “help” you output nice text. Down side is, it comes along with a copy and paste.

Clean that bad markup with HTML Tidy! Paste in a URL, copy and paste text, or upload a file, and outputs neatly structured HTML goodness.

Straight up TEXT list of US States in Alphabetical order. Bonus: an Excel version!

Thursday, January 21st, 2010

For some reason, this is a pain in the neck to find and I always have to end up copying and pasting some list with extra crap in it. For once and for all, here it is.

(more…)

When does a web developer not care about what browser you use?

Tuesday, January 19th, 2010

When shit that I want to create doesn’t work on your browser, that’s when.

I’m learning about the Document Object Model so that I can build killer web applications. Unfortunately, different browsers will read my code differently, and in many cases, throw massive coronary errors and refuse to work.

If you use Netscape Navigator, Internet Explorer <= 6, or any other browser that does not support the traditional event registration model, you’re shit out of luck. This allows me to at least get my web app off the ground before I start worrying about everyone and their mom that uses IE6 going to the site and having it not work. I’ll get it off the ground, then pay someone else to make it work in other crap. In the mean time, when someone goes to the site, they’ll see a blank page with links to browsers that work.

Just learning how to manipulate the Document Object Model with Javascript.

Tuesday, January 19th, 2010

Event Listeners own me.

I’ve been DEATHLY scared of these damn things my entire professional career. Finally, last night, in an attempt to create my first full-on javascript / php / mysql / ajax / blablabla some other web technology, I started to come to terms with the fact that yes, I need to learn it if I want to create some truly awesome web apps.

I’ve “used” them before. Usually, this entails going to someone else’s site that had what I needed to accomplish already completed and there for the download / copy / paste. However, with this new project that’s consuming my mind, I need to learn them. I need to make 100% unique javascript functions in order to accomplish my goals. I think that as I learn this stuff I’ll post here, but most likely I’ll just post some strings of code with a post titled “EUREKA!”

Migrating to WordPress for a blog

Tuesday, January 19th, 2010

I’ve decided that since CMS Made Simple doesn’t have any of the automatic pinging capabilities that WordPress does that I should migrate over and continue blogging from it instead. I’ve transferred most of my posts over, but not all because those that actually could be wanted by someone are ~10, and the rest is just crap. I feel that part of my professional growth is going to be creating a journal of successes(what few I have), failures(what many I have), trials(shitloads of them), and tribulations(whatever these are).

Moving forward with a good platform is key; I’m going to continue to develop sites with CMSMS but I’m not going to be using it myself on this site. WordPress development is something I’ve been meaning to get in to for a while as well though, so maybe actually having a site to do it on will spur action on my part.

Integrating Calendar and Google Maps in CMSMS

Tuesday, January 19th, 2010

I recently had to do a website for a family friend who’s getting married. They were having a destination wedding, and one of the things they wanted to do on the site was have calendar items below a Google Map, with the addresses associated with the events reflected on the map.

I could have had it be a little redundant, but this is the sort of puzzle I like figuring out, so I set to work.

I use CMS Made Simple for most of the sites I do for folks nowadays, because it’s open source and excellently put together.

I installed Calguy’s Calendar and Google Maps modules, and set to work. I created an upcoming list template to display all the events; pretty easy.

One of the field definitions on the Calendar module was “Address” so that they could put in the event’s location. This would come in handy for my map points!

Next was getting the map set up. After setting up the module with the API key for Google Maps, I created an new map and added a central map point. (the map won’t display without one, something I didn’t realize at first)

The Google Maps module includes a plugin for creating dynamic map points on the fly. I created another upcoming list template in the calendar module to automatically create these map points dynamically. Sample code below. I had to use the smarty “assign” function to get them to work correctly; don’t ask me why.


{foreach from=$events key=key item=event}
{assign var=event_title value=$event.event_title}
{assign var=event_date value=$event.event_date_start|date_format:"%e"}
{assign var=event_summary value=$event.event_summary}
{assign var=event_address value=$event.fields.Address}

{cggm_add_dynpoint map=1 name="$event_title" address="$event_address" description="$event_summary"}
{/foreach}

This way, any new calendar item they created would be created on the map!

Note: when you add any code or dynamic points, make sure to add them below wherever you create the map! Otherwise they don’t show up!

Creating a Document Management System with CMS Made Simple and some modules

Tuesday, January 19th, 2010

So I had to create a system where users could register, login, and upload files. The system would need to show each user his/her files and no one else’s, and get in touch with the administrator to let them know a new file was uploaded.

There’s nothing inherent in CMS Made Simple to accomplish this, but I used a couple of modules (FrontEndUsers, SelfRegistration, CustomContent, and Uploads) to take care of the job. It’s easy enough that I know the developer meant it to be used this way if someone needed it. I’m not going to explain SelfRegistration here, that’s for another post. However, here’s the instructions for the Document Manager:

  1. Install FrontEndUsers, SelfRegistration, CustomContent, and Uploads (Front End File Management)
  2. Add 2 pages to the site. Call one “Document Manager” and the other “Send a File”
  3. In FrontEndUsers, create the User Properties you’ll need for your registered users.
  4. Create the User’s Group.
  5. Put the “Document Manager” and “Send a File” pages behind a login using FEU
  6. In Uploads, create the Category “Client Uploads.”
  7. In the Page “Document Manager,” insert the code below:

    {assign var=email value=$ccuser->username()}
    {cms_module module="Uploads" category="Client Uploads" mode="summary" key=$email}

    For some reason, I always have better luck assigning any Smarty object variable to a regular variable before using it in another tag. Might be me, I dunno.

  8. In the Page “Send a File,” insert the code below:

    {assign var=email value=$ccuser->username()}
    {cms_module module="Uploads" category="Client Uploads" mode="upload" noauthor="1" key=$email}

    Using the Key attribute for the Uploads module tag in both places inserts whatever file into the database with the key equal to the user’s username, and then allows me to pull it out by the same.

  9. Pretty much done; make it look pretty with some CSS and you should be all set.

Users can register, login, and upload files. They only see their files, and the administrator can log into the backend and manage them there. Mission accomplished.

Front End User Photo Galleries

Tuesday, January 19th, 2010

This was somewhat quick and dirty. However, it works very well for what I need and if anyone else would like to use it, go for it.

I had a need for a way to enable an administrator to manage photo galleries on a per-user basis. I figured that the best thing to do would be to make some sort of connector between Photo Album and FrontEndUsers, but I wasn’t quite sure that was possible, and also whether or not I could pull it off regardless. So, instead I edited FrontEndUsers, and Copied and created a new Module from Photo Albums and called it FEUAlbum. Neither of these modules will be supported by me, (unless there’s money involved) and I don’t expect to extend them beyond what I’ve done. Obviously the original authors of the modules are not going to support an edited version of their module.

Those disclaimers aside, here we go.

Vanilla installation of CustomContent is used.

In FrontEndUsers, I created a new “field type” in the User Properties called “Album.” Adding this to a group will make a link appear when you edit a user. Clicking the link, if the user has no photo album at the moment, will create the photo album using the user’s FEU id as the album id, and the user’s username as the album name. If the user has a current album created already, this link will take the administrator to it to manage it.

Copying Album to a new module was easy. Installing FEUAlbum will NOT overwrite anything from the original module (Album) and both can run side-by-side. New database tables were created throughout and the links to files are correct. All other functionality, including templates, works as expected.

Insert the module tag in the template or page like so:

{cms_module module="FEUAlbum" albums=$ccuser->LoggedIn()}

Calls the module and uses the user’s ID as the album number, which pulls in the relevant album. Obviously the user should be required to log in before access to the album is allowed.

The goal was to do the least amount of work and get the greatest functionality out of it. One caveat is that each user can only have 1 album assigned to them.

I hope this helps someone out; I’ve attached zip files for the edited modules.