Forum OpenACS Q&A: A newbie question...

Collapse
Posted by Dean Des Rosiers on
I'm working through OpenACS today and putting together a small
website.  I added a photo-album to the site, and wish to change the
UI a bit.  I assume I just go into the packages/photo-album/www
directory and mess around.

Now, what if I want another photo album with a different
appearance?  It looks like there is only one photo-album directory,
even if I mount it at two points in my site map, correct?

How is this sort of thing generally handled?

Collapse
Posted by Don Baccus on
To change the superficial appearance (as opposed to UI and page flow details) you could mount photo-album under two separate subsites, then change the two subsite's default master template parameter to point to two different master templates, each implementing a different look.

By defining different style sheets and (if necessary) modifying the original templates to refer to your custom stylesheet definitions, you could change the superficial look-and-feel considerably.

If you just want to make minor changes to the appearance of the photo-album package for the two cases, you could add a parameter to the package and modify the photo-album master template so it changes its appearance depending on its value.  You'd set the parameter value from the site map admin pages after mounting each instance.

The above is also true if you just want to make minor changes to the UI for the two instances.

If you want to substantially change the UI for the two, you either need to heavily conditionalize the scripts and templates, or execute different scripts for the two mount points.  Heavily conditionalized scripts are hard to read and maintain so I'd favor the separate script/template approach in this case.

The best thing to do, then, would be to create a new package called "my_photo_db", and move all the script and template files into that package directory.  You can use the package manager to set up the package and after moving the files over you'd use it to add them to the package .info file.

I'm guessing from your note that you can still share the standard photo-album datamodel, so you would only need to move script and template files.

Then you'd have two packages, "photo_album" and "my_photo_album".  You could mount the original when you want the original UI, and mount "my_photo_album" to use your custom UI (in your case you have two custom UIs but the idea's the same).

You could then rewrite "my_photo_album" to your heart's content, just taking care to not break any of the assumptions in the datamodel.

There's no single "right answer" - the best approach depends on just how much you want the two instances to differ.