Customizing catalogs

KavaTunes creates dyanmic catalogs that use the PHP scripting language. With a little PHP, HTML and CSS, you can customize the appearance of catalogs, change the way catalogs work, or even add dynamic content to your own pages.

Model, view, controller

Catalogs are divided according to the model, view, controller (MVC) paradigm:

Keeping the model, view and controller separate lets you update the data, appearance and logic independently. For example, you can make changes to the templates and simply reload your browser, without even launching KavaTunes. And when you publish the catalog, the data files are updated but your changes to the templates will not be overwritten.

Customizing the appearance

You can modify the appearance of catalogs by tweaking the HTML code, editing graphics in Photoshop, or changing the CSS style sheets. The templates are in fact PHP documents that generate HTML code using PHP functions.

Modifying catalog logic

Catalogs use the object-oriented features of PHP to represent your music. The shared folder contains PHP classes that define the properties of genres, artists, albums, songs, playlists, and artwork. You could, for example, modify the behaviour of these objects by defining additional class methods.

Creating new templates

You can create templates with your own designs, or add dynamic content from KavaTunes to your existing web pages. The best way to start is by copying all or part of one of the existing templates. You'll want to refer to the PHP documentation.

For example, to add a list of recently played songs to your home page, you can copy the function sidebar_list() from the file itunes/home.php.

Make sure to change the extension of your documents from .html to .php so that the web server will process them correctly.

Contributing layouts

If you have created a cool layout, added new behavior to the PHP objects, or done anything else that you'd like us to know about, email us your code and we can include your contributions in the next version of KavaTunes!

Updating KavaTunes

When you update to a new version of KavaTunes, the program will ask if you want to update the catalog files. If you have customized the templates, your changes may be overwritten. Therefore, you should work on a copy of the templates, or back up any files that you have modified. You can merge in changes using the FileMerge application, which is part of the Apple Developer Tools.