How to make stylin' the ALBUM module easier

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am

How to make stylin' the ALBUM module easier

Post by Simon66 »

Iwas having a big problem styling the ALBUM module as my site CSS was overriding the Album CSS, in particular the UL and LI tags.

I found the reason for this was that the Album stylesheet was being put above the other stylesheets.

This is the fix to put the Album stylesheet last and let it override any other style declarations.

Open -  modules\Album\classes\module\class.Album.php
On or around line 126 you should find:
{
$content = str_ireplace('', "\n".$text, $content);
}
else
{
$content = eregi_replace('', "\n".$text, $content);
}

Replace it with this:
{
$content = str_ireplace('', $text."\n", $content);
}
else
{
$content = eregi_replace('', $text."\n", $content);
}

Done
Hope it helps
Simon66
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

This must be Thursday. I never could get the hang of Thursdays.

Douglas Adams - The only sane person in the asylum.
sleepingcavalry
Forum Members
Forum Members
Posts: 19
Joined: Thu Feb 05, 2009 1:37 am

Re: How to make stylin' the ALBUM module easier

Post by sleepingcavalry »

Thanks for posting your troubleshooting.


I took a quick stab at this technique, thinking I can always simply reverse the effects if it goes wrong.  I think I was wrong. I am now getting an error before the doctype on each document sent to the browser.

it looks like this:



Warning:  Cannot modify header information - headers already sent by (output started at /home/content/d/a/n/dantef/html/jelani/modules/Album/classes/module/class.Album.php:1993) in /home/content/d/a/n/dantef/html/jelani/index.php on line 327





As you can see the doctype is after the error. Any thoughts? Did your quick fix end up altering an additional file besides class.Album.php?
sleepingcavalry
Forum Members
Forum Members
Posts: 19
Joined: Thu Feb 05, 2009 1:37 am

Re: How to make stylin' the ALBUM module easier

Post by sleepingcavalry »

I found my problem. I was using spaces in the replacement code. Strangely enough I am now getting a "d" character displaying as the first thing, top right in the browser window. I assume this is some kind of leftover from the incorrect whitespace. Any ideas about where that file class.Album.php writes to? does it mod anything throughout the CMS that isn't just a temporary setting for a single request?
User avatar
duclet
Forum Members
Forum Members
Posts: 187
Joined: Fri Jun 23, 2006 12:55 pm

Re: How to make stylin' the ALBUM module easier

Post by duclet »

Why not just replaced your modified file with the original file by downloading it from the forge if you want to revert it.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How to make stylin' the ALBUM module easier

Post by Dr.CSS »

I've always found it best to just open the album css and copy it into a new stylesheet and attach that to the page template using the Album tag...
sleepingcavalry
Forum Members
Forum Members
Posts: 19
Joined: Thu Feb 05, 2009 1:37 am

Re: How to make stylin' the ALBUM module easier

Post by sleepingcavalry »

duclet wrote: Why not just replaced your modified file with the original file by downloading it from the forge if you want to revert it.
Well, thats my usual route when i hit a dead end like this but after a few times uninstalling/reinstalling the module I was working on, as well as fresh copies of the files for the module, things are still a bit screwy. 

I'm still getting a single d character in the upper left corner and a blank line before the doctype in the generated page.  I've gone into debug mode as well and it yields nothing but positive signs.


I guess basically I asking if you know of any other troubleshooting tips after these that I have tried.  Would much appreciate any ideas. 

Thanks

**** Update: turns out I had a sloppy stray character sitting in the main template.  Next time, I'll wait a bit longer before going for help.*****
Last edited by sleepingcavalry on Tue Feb 24, 2009 8:13 pm, edited 1 time in total.
sleepingcavalry
Forum Members
Forum Members
Posts: 19
Joined: Thu Feb 05, 2009 1:37 am

Re: How to make stylin' the ALBUM module easier

Post by sleepingcavalry »

I usually work with the cascade and targeting selectors before going into any php for changes.

If your styles on and elements are being over-riden, you can target them with a more specific selector that heads down from the top object. 

example:

if 

Code: Select all

<ul id='special'>
 

is not displaying according to:   

Code: Select all

 #special {list-style:none;} 
   

because of some other styling, then you can use a more robust selector combination such as:

Code: Select all

 body div#main div.someClass div#smallerBlock ul#special {list-style:none;} 
   
CSS is very consistent with over-riding selectors like this one. Whatever comes down from the highest object wins.  Going this route might save you time with some style sheets!
Post Reply

Return to “Tips and Tricks”