Saturday, February 21, 2009

Blogger CSS Syntax Highlight

Original article posted at here,but url change to be 'http://store.bernie.twbbs.org/home/download/'(updated 2009/07/29).

FILE, .file{
display: block; /* fixes a strange ie margin bug */
font-family: 'Georgia';
font-size: 10pt;
color: #000;
overflow: auto;
background: #FFF url(http://store.bernie.twbbs.org/home/download/BG_FILE.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
line-height: 1.2em;
}

CODE, .code {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 10pt;
overflow:auto;
color: #ccc;
background: #000 url(http://store.bernie.twbbs.org/home/download/BG_CODE.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
line-height: 1.2em;
}

CMD, .cmd {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 10pt;
overflow:auto;
color: #ccc;
background: #000 url(http://store.bernie.twbbs.org/home/download/BG_CMD.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
line-height: 1.2em;
}


Using PHP function htmlspecialchars and htmlentities to prevent browser confusing with HTML elements likes '<', '&', '>'.


function changeHTMLCode($aInputData)
{
$sInputCode = $aInputData['inputCode'];
$sInputCode = htmlspecialchars($sInputCode);
$sInputCode = htmlentities($sInputCode);

$objResponse = new xajaxResponse();
$objResponse->append('log', 'innerHTML', "Sent message to change HTML code
");
$objResponse->assign("outputCode", "innerHTML", "");
$objResponse->assign("outputCode", "innerHTML", $sInputCode);
return $objResponse;
}

No comments:

Post a Comment