Page 1 of 1

Displaying CSS Title (with my solution)

Posted: Tue May 23, 2006 8:57 am
by fredt
When I look at the generated CSS, it's quite difficult to figure from which sub-CSS the property comes.
So I modified stylesheet.php this way:

if ($config['dbms'] == 'mysqli' || $config['dbms'] == 'mysql')
{
$db = mysql_connect($config['db_hostname'], $config['db_username'], $config['db_password']);
mysql_select_db($config['db_name']);
if ($name != '')
$sql="SELECT css_text FROM ".$config['db_prefix']."css WHERE css_name = '" . mysql_real_escape_string($name, $db) . "'";
else
$sql="SELECT c.css_text,c.css_id,c.css_name FROM ".$config['db_prefix']."css c,".$config['db_prefix']."css_assoc ac WHERE ac.assoc_type='template' AND ac.assoc_to_id = $templateid AND ac.assoc_css_id = c.css_id AND c.media_type = '" . mysql_real_escape_string($mediatype, $db) . "'";
$result=mysql_query($sql);
while ($result && $row = mysql_fetch_assoc($result))
{
$css .= "\n\n\n/* *** CSS Name : ".$row['css_name'] . " *** */\n\n". $row['css_text'];
}
}


So now I get this CSS

Code: Select all

/* *** CSS Name : Typography *** */

/* A CSS Framework by Mike Stenhouse of Content with Style */

/* TYPOGRAPHY */
	body {
		text-align: left;
I think this could/should be polished... and added to the standard stylesheet.php?

Re: Displaying CSS Title (with my solution)

Posted: Tue May 23, 2006 7:12 pm
by Elijah Lofgren
A patch that does something just like this made it into SVN trunk today: http://dev.cmsmadesimple.org/tracker/in ... d=103  ;)