Ah OK,
what about something along these line, caching and your business model aside....
PHP Code:
<?php
#style.php
define('RYAN_APP_THEME_KEY', 'userDefinedThemeKey');
header('text/css');
echo file_get_contents(
sprintf(
'http://www.yourserver.com/getCSS.php?themeKey=%s',
RYAN_APP_THEME_KEY
)
);
exit;
?>
PHP Code:
<?php
#getCSS.php
if(isset($_GET['themeKey']) && !empty($_GET['themeKey']))
{
$sSQL = sprintf(
"SELECT css FROM themes WHERE themeKey = '%s'",
mysql_real_escape_string($_GET['themeKey'])
);
$rResult = mysql_query($sSQL);
if(mysql_num_rows($rResult) > 0)
{
$aResultSet = mysql_fetch_assoc($rResult);
echo $aResultSet['css'];
exit;
}
}
exit;
?>
Code:
<form action="http://www.yourserver.com/themer/add.php" method="post">
<!-- FORM FIELDS -->
</form>
Your form would get the required data and a unique theme name from the user and submit this to 'add.php' on your server, your server would then save this to the database. Of course this could quite easily be a local file, or as hinted at, a post-processed theme based on the submitted values.
The user would then just add 'style.php' as the src for a style element on their page, along with defining the RYAN_APP_THEME_KEY constant inside it.
This would require the user to edit this file each time a new theme was created though, if you had a username / password combo though, you could pass these instead and load the latest CSS created.
style.php would obtain the data returned by getCSS.php located on your server and output it as CSS based on the theme key.
Maybe?
Bookmarks