[thelist] style switcher in php?

shawn allen shawn at alterior.net
Sat Oct 26 15:27:01 CDT 2002

quoth MarsHall:
> On Saturday, October 26, 2002, at 12:18 PM, noah wrote:
> >Maybe I'm missing something here, but if you're going to predefine
> >style sheets, why not just use the variable "$style", make it a
> >number,
> >Then it doesn't matter what people try to force "$style" to be.
> That's more secure, yes, but not the most sustainable solution.
> If you (or someone else!) ever want to add new style sheets, you/they
> must remember to change that "predefined style sheet" code.

Regardless, you've still got to change every page (or include, whatever)
that renders the form that's used to change the stylesheet. What you
really need is a solution that references a list of available
stylesheets from a single point. Ideally, you'd have a configuration
file where the list of available stylesheets is listed, either by full
URI or filenames without the css suffix. That way, your check is just a
simple in_array() condition.

One such implementation: <http://alterior.net/s3/>

Another that builds on the ALA switcher (but doesn't make the list of
available styles accessible to the referring form/link):

shawn allen
  e: shawn at alterior.net
  p: 415 577 3961
  im: shawnpallen

More information about the thelist mailing list