IT WORKS!!! IT WORKS!!! This is beautiful. Nothing in config.inc.php. No lengthy if/elses clogging up everything. Nothing to modify if colorset choices change. Now, remember, I have YET to attempt anything with the feed icon, and this method may NEVER get a feed icon to change (until someone gives us a tpl for any of the plugins that are missing them. However, this works for colorset css files, calendar arrows (which I also use in my entries), and the graph bar on the archive page.
config.inc.php:
Code: Select all
$template_config = array(
array(
'var' => 'colorset',
'title' => 'Color Set',
'description' => 'Select the color set you want to use',
'type' => 'select',
'default' => 'ltgrey',
'select_values' => array('ltgrey' => 'Light_Grey', 'dkgrey' => 'Dark_Grey', 'blue' => 'Blue')
),
In my template directory, I have css files for each of these colorsets as follows: ltgrey_style.css, dkgrey_style.css and blue_style.css (ie, "colorset_style.css"). I also have similarly named graphics in the template's /img/ folder, as follows: ltgrey_back.gif, ltgrey_forward.gif, ltgrey_xml.gif and ltgrey_graph_bar.png. I have these for each color, consistently named as "colorset_imagename, just like the css filenames.
Again, I have not touched the feed icons yet, but here is what I have for everything else:
index.tpl & commentpopup.tpl:
Code: Select all
<!-- in addition to the template style.css, use additional stylesheet that corresponds to selected colorset -->
<link rel="stylesheet" type="text/css" href="{$serendipityHTTPPath}templates/{$template}/{$template_option.colorset}_style.css" />
In plugin_calendar.tpl (left/back arrow shown first, right/forward arrow second):
Code: Select all
<a title="{$CONST.BACK}" href="{$plugin_calendar_head.uri_previous}"><img alt="{$CONST.BACK}" src="{$serendipityHTTPPath}templates/{$template}/img/{$template_option.colorset}_back.gif" /></a>
<a title="{$CONST.FORWARD}" href="{$plugin_calendar_head.uri_next}"><img alt="{$CONST.FORWARD}" src="{$serendipityHTTPPath}templates/{$template}/img/{$template_option.colorset}_forward.gif" /></a>
I also use the calendar arrow for the previous/next page in entries, so entries.tpl (again, left/previous first, right/next second:
Code: Select all
{if $footer_prev_page}
<a title="{$CONST.PREVIOUS_PAGE}" href="{$footer_prev_page}"><img alt="{$CONST.PREVIOUS_PAGE}" title="{$CONST.PREVIOUS_PAGE}" src="{$serendipityHTTPPath}templates/{$template}/img/{$template_option.colorset}_back.gif" /></a>
{/if}
{if $footer_next_page}
<a title="{$CONST.NEXT_PAGE}" href="{$footer_next_page}"><img alt="{$CONST.NEXT_PAGE}" title="{$CONST.NEXT_PAGE}" src="{$serendipityHTTPPath}templates/{$template}/img/{$template_option.colorset}_forward.gif" /></a>
{/if}
And finally, the graph bar used in entries_archives.tpl (BulletProof version):
Code: Select all
<li class="archives_graph"><img src="{$serendipityHTTPPath}templates/{$template}/img/{$template_option.colorset}_graph_bar.png" alt="bar graph" height="10" width="{math width=100 equation="count * width / max" count=$month.entry_count max=$max_entries format="%d"}" style="border: 1px solid #000000" /></li>
Ultimately, we explored about 4 different ways to make this happen. Looks like the simplest is the best. Just follow a consistent naming convention for the images, and everything works great. The best part is there is no need to modify any of these tpls for colorset name modifications or additions.
Whew.... so many hours into such a little thing!!! What an education!! I need a drink!
