Page 1 of 1
[Solved] How do you attach templates to the Album module?
Posted: Tue Nov 27, 2007 1:09 pm
by Deak
I have looked through the documentation and scanned these forums, but I cannot find a thread or page that clearly explains how this process works. Or not for my circumstances, anyway. Either they are assuming something which I don't know, or perhaps my installation of CMSMS is somehow missing something vital. Or both.
Here's what I have done:
- Installed Album 0.9.2
- Created a category
- Gone to the Available Templates tab and imported the Templates that I want by clicking the Import Template link
- In the Template tab, set the Album List Template to be "Lightbox"
- Created an album, assigned it to my category, and attached 18 images
- In the album's Properties tab I have set the Template to be "Lightbox"
And the page containing my album appears unstyled.
My guess is that the Templates I have available in the Album's Templates tab:
categories
default
greybox
ImageGallery
lightbox
random_image
recently_updated
Thickbox
... need to be set up somewhere else in the system. A few threads have alluded to this, but what I suppose I was expecting was, having imported the "Lightbox" template that it would appear as a stylesheet option to attach to my page's Template. But it doesn't.
What am I missing here?
Many thanks for any help you can offer.
Re: How do you attach templates to the Album module?
Posted: Tue Nov 27, 2007 7:34 pm
by neophron
Hi,
is your site online? I tested it on my system, 1.2 and album 0.9.2. After changing a template the attached css is also changing, you don't have to attach an additional css. No idea what it could be.

Does your default template works? If yes, change the default css. The attachment shows the path to the lightbox css.
neophron
Re: How do you attach templates to the Album module?
Posted: Tue Nov 27, 2007 11:16 pm
by carasmo
the css for the album is here:
modules/Album/css/stylesheet.css
It is attached automatically in the head of the page that has the album tag. Look at your source html to confirm that the path is correct.
To remove it, do this:
Open the "class.Album.php" file
Make a back up
It's located here: modules/Album/classes/module/class.Album.php
Find and remove the following code, be careful to remove only what is shown here, nothing more or less:
Code: Select all
**
* Automatically inserts the call to the Album stylesheet in the head tags.
* Code adapted from the News module
function ContentPostRender(&$content)
{
if (1 == $this->GetPreference('autolinkstylesheet', 1))
{
global $gCms;
$config =& $gCms->GetConfig();
$text = '<link rel="stylesheet" type="text/css" href="'.$config['root_url'].'/modules/Album/css/stylesheet.css" />';
if (function_exists('str_ireplace'))
{
$content = str_ireplace('<head>', "<head>\n".$text, $content);
}
else
{
$content = eregi_replace('<head>', "<head>\n".$text, $content);
}
}
}
*/
Then grab that style sheet in the /modules/Album/css/ folder "stylesheet.css" and paste it into a new style sheet in the CMSMS way and adjust to your liking. Assign it to your template.
Re: How do you attach templates to the Album module?
Posted: Thu Nov 29, 2007 10:03 am
by Deak
neophron wrote:
Hi,
is your site online? I tested it on my system, 1.2 and album 0.9.2. After changing a template the attached css is also changing, you don't have to attach an additional css. No idea what it could be.

Does your default template works? If yes, change the default css. The attachment shows the path to the lightbox css.
neophron
No, it's not online at the moment.
I'm not sure if the default template is working; its output for the gallery is formatted in Courier, and the screenshots are unstyled bullets. Is this correct for the default?
The stylesheets in the header of the page are not displayed normally, rather they are shown as:
So I can't easily be sure whether it is actually attaching the Lightbox css that I want.
Re: How do you attach templates to the Album module?
Posted: Thu Nov 29, 2007 10:07 am
by Deak
Carasmo,
Thanks for your solution, which I think probably will work. However, I am very keen to keep CMSMS as standard as possible without hacking it. I hope to use CMSMS for future web projects and I think, going forward, such manual hacks aren't the way I want to work. I like to keep things "vanilla" so that future upgrades aren't closed to us or difficult to implement.
Clever idea though, so kudos for that.
/Deak
Re: How do you attach templates to the Album module?
Posted: Fri Nov 30, 2007 3:28 pm
by carasmo
All the other modules work with a style sheet being attached the CMSMS way, this module works non-standard. So I just make myself a list of mods and the line numbers so it's easy to remember to do that for the next install. The form builder uses embedded styles too which override your own styles, so I've removed them too. I try to make things run the way Ted makes the core run, rather than having to bounce around to different locations for styles and other stuff.
Re: How do you attach templates to the Album module?
Posted: Thu Dec 06, 2007 9:54 am
by Deak
Hi Carasmo,
I went with your solution in the end and it works lovely.
Many thanks mate.
Re: [Solved] How do you attach templates to the Album module?
Posted: Fri Dec 14, 2007 6:53 pm
by Dr.CSS
@ Deak
If you were getting unstyled albums it may have been that in the options tab of Album you didn't have the auto attach CSS box ticked, it also has a view CSS link that can be used to see the default CSS that I use to copy/paste it into a new style sheet I attach to my template...