Ragazzi ho creato un foglio di style facendogli prendere direttamente i valori dal db in questo modo
Codice PHP:
<?php
// Imposto come pagina CSS il file;
header("Content-type: text/css");
include('config.php');
$style="SELECT * FROM style_zero";
$query_sql=@mysql_query($style);
$style_row = @mysql_fetch_array($query_sql);
if(!$style_row) die("Errore MySQL: ".mysql_error().'"
Query:
"'.$query_sql);
echo ("body {
font-family: '" . $style_row['body_1'] ."';
font-size: '" . $style_row['body_2'] . "';
color: '" . $style_row['body_3'] . "';
background-attachment: '" . $style_row['body_4'] . "';
background-color: '" . $style_row['body_5'] . "';
background-image: '" . $style_row['body_6'] . "';
background-repeat: '" . $style_row['body_7']. "';
background-position: '" . $style_row['body_8'] . "';
letter-spacing: '" . $style_row['body_9'] . "';
text-align: '" . $style_row['body_10']. "';
word-spacing: '" . $style_row['body_11']. "';
margin-top: '" . $style_row['body_12']. "';
margin-right: '" . $style_row['body_13']. "';
margin-bottom: '" . $style_row['body_14']. "';
margin-left: '" . $style_row['body_15']. "';
cursor: '" . $style_row['body_16']. "';
}\n");
echo (".banner {
background-color: '" . $style_row['banner_1']. "';
background-repeat: '" . $style_row['banner_2']. "';
height: '" . $style_row['banner_3']. "';
width: '" . $style_row['banner_4']. "';
margin-top: '" . $style_row['banner_5']. "';
margin-right: '" . $style_row['banner_6']. "';
margin-bottom: '" . $style_row['banner_7']. "';
margin-left: '" . $style_row['banner_8']. "';
padding-right: '" . $style_row['banner_9']. "';
}\n");
echo ("input {
font-family: '" . $style_row['input_1']. "';
font-size: '" . $style_row['input_2']. "';
color: '" . $style_row['input_3']. "';
background-color: '" . $style_row['input_4']. "';
text-align: '" . $style_row['input_5']. "';
border: '" . $style_row['input_6']. "';
}\n");
echo ("textarea {
font-family: '" . $style_row['textarea_1']. "';
font-size: '" . $style_row['textarea_2']. "';
color: '" . $style_row['textarea_3']. "';
background-color: '" . $style_row['textarea_4']. "';
text-align: '" . $style_row['textarea_5']. "';
border: '" . $style_row['textarea_6']. "';
}\n");
echo ("a:link {
font-family: '" . $style_row['link_1']. "';
font-size: '" . $style_row['link_2']. "';
color: '" . $style_row['link_3']. "';
text-decoration: '" . $style_row['link_4']. "';
text-align: '" . $style_row['link_5']. "';
}\n");
echo ("a:visited {
font-family: '" . $style_row['visited_1']. "';
font-size: '" . $style_row['visited_2']. "';
color: '" . $style_row['visited_3']. "';
text-decoration: '" . $style_row['visited_4']. "';
text-align: '" . $style_row['visited_5']. "';
}\n");
echo ("a:hover {
font-family: '" . $style_row['hover_1']. "';
font-size: '" . $style_row['hover_2']. "';
color: '" . $style_row['hover_3']. "';
text-decoration: '" . $style_row['hover_4']. "';
text-align: '" . $style_row['hover_5']. "';
}\n");
echo ("a:active {
font-family: '" . $style_row['active_1']. "';
font-size: '" . $style_row['active_2']. "';
color: '" . $style_row['active_3']. "';
text-decoration: '" . $style_row['active_4']. "';
text-align: '" . $style_row['active_5']. "';
}\n");
echo (".titolo {
font-family: '" . $style_row['titolo_1']. "';
font-size: '" . $style_row['titolo_2']. "';
font-weight: '" . $style_row['titolo_3']. "';
color: '" . $style_row['titolo_4']. "';
text-align: '" . $style_row['titolo_5']. "';
margin-top: '" . $style_row['titolo_6']. "';
margin-right: '" . $style_row['titolo_7']. "';
margin-bottom: '" . $style_row['titolo_8']. "';
margin-left: '" . $style_row['titolo_9']. "';
}\n");
echo (".contenuto {
font-family: '" . $style_row['contenuto_1']. "';
font-size: '" . $style_row['contenuto_2']. "';
line-height: '" . $style_row['contenuto_3']. "';
font-weight: '" . $style_row['contenuto_4']. "';
color: '" . $style_row['contenuto_5']. "';
text-align: '" . $style_row['contenuto_6']. "';
margin-top: '" . $style_row['contenuto_7']. "';
margin-right: '" . $style_row['contenuto_8']. "';
margin-bottom: '" . $style_row['contenuto_9']. "';
margin-left: '" . $style_row['contenuto_10']. "';
}\n");
echo ("img {
padding-top: '" . $style_row['img_1']. "';
padding-right: '" . $style_row['img_2']. "';
padding-bottom: '" . $style_row['img_3']. "';
padding-left: '" . $style_row['img_4']. "';
border: '" . $style_row['img_5']. "';
}\n");
echo (".calendario {
font-family: '" . $style_row['calendario_1']. "';
font-size: '" . $style_row['calendario_2']. "';
color: '" . $style_row['calendario_3']. "';
text-align: '" . $style_row['calendario_4']. "';
margin-top: '" . $style_row['calendario_5']. "';
margin-right: '" . $style_row['calendario_6']. "';
margin-bottom: '" . $style_row['calendario_7']. "';
margin-left: '" . $style_row['calendario_8']. "';
}\n");
echo(".rosso {
font-family: '" . $style_row['rosso_1']. "';
font-size: '" . $style_row['rosso_2']. "';
color: '" . $style_row['rosso_3']. "';
}\n");
echo (".verde {
font-family: '" . $style_row['verde_1']. "';
font-size: '" . $style_row['verde_2']. "';
color: '" . $style_row['verde_3']. "';
}\n");
echo (".news {
font-family: '" . $style_row['news_1']. "';
font-size: '" . $style_row['news_2']. "';
color: '" . $style_row['news_3']. "';
text-align: '" . $style_row['news_4']. "';
margin-top: '" . $style_row['news_5']. "';
margin-right: '" . $style_row['news_6']. "';
margin-bottom: '" . $style_row['news_7']. "';
margin-left: '" . $style_row['news_8']. "';
}\n");
echo (".piccolibanner {
border: '" . $style_row['piccolibanner_1']. "';
padding: '" . $style_row['piccolibanner_2']. "';
height: '" . $style_row['piccolibanner_3']. "';
width: '" . $style_row['piccolibanner_4']. "';
}\n");
echo ("table {
font-family: '" . $style_row['table_1']. "';
background-color: '" . $style_row['table_2']. "';
background-image: '" . $style_row['table_3']. "';
background-repeat: '" . $style_row['table_4']. "';
}\n");
echo (".contatore {
font-family: '" . $style_row['contatore_1']. "';
font-size: '" . $style_row['contatore_2']. "';
color: '" . $style_row['contatore_3']. "';
}\n");
echo (".copyright {
font-family: '" . $style_row['copyright_1']. "';
font-size: '" . $style_row['copyright_2']. "';
color: '" . $style_row['copyright_3']. "';
}\n");
echo (".strutturabanner {
background-color: '" . $style_row['strutturabanner_1']. "';
background-image: '" . $style_row['strutturabanner_2']. "';
background-repeat: '" . $style_row['strutturabanner_3']. "';
}\n");
echo (".sottolink{
background-color: '" . $style_row['sottolink_1']. "';
background-image: '" . $style_row['sottolink_2']. "';
background-repeat: '" . $style_row['sottolink_3']. "';
}\n");
?>
poi imporatto nel pagina php dove sta la grafica
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Progetto Zero OpenSorce</title>
<style type="text/css">
@import url("style.php");
</style>
</head>
<body>
<div class="rosso">Prova</div>
duc
</body>
</html>
Ma non funziona sapreste dirmi come mai? o.o' grazie sempre in anticipo per le rispsote