Sunday, February 24, 2013

Using Php To Switch Css Styles Function

Use Php To Switch Css Styles Function()


My Template Engine----> This is a secret ! Not very many programers know of this. This can switch css style sheets using php by calling this function verses another one,,in which many think impossible.
?php start tag here

function cssTemp()
{
?> php end tag here
#header_grad {
 background-image: url(/images/networks/header_grad.png);
 background-position: 0 0;
 background-repeat: no-repeat;
 float: left;
 width: 100%;
 min-height: 130px;
}

#header h1 {
 margin: 45px 28px 0 28px;
}

#header h2 {
 margin: 0 28px 0 28px;
 padding: 2px 0 26px 0;
}

#content_wrapper h3.pagetitle {
 font-size: 22px;
 font-weight: normal;
 padding-top: 10px;
 margin-bottom: 23px;
 font-family: "Trebuchet MS";
}

#header .logo {
 margin: 45px 0 45px 28px;
}
?php start tag here

} //end function cssTemp()
?> php end tag here

Then simply call the function at the top of a page between the script tags.
Add as many as you want using php if conditions= ??? if condition=true { echo csstemp1() } else { echo cssTemp2() } click a button to change templates.

1 comment: