[英]How to make my a cms that can change themes like tumblr
大家好。 我想知道如何為像tumblr這樣的cms我的主題設置選項? 我了解如何使用tumblr,{description},{text}之類的代碼以及類似的變量,但是如何在php中創建這樣的主題切換器呢?
只需將php變量放在您的頭部。 確保在頁面的開頭創建$ userCSSchoice,否則將全部破壞! 厄運!
<LINK REL=StyleSheet HREF="<?php echo $userCSSchoice; ?>.css" TYPE="text/css" MEDIA=screen>
不,是的,我確實做到了,對我來說效果很好。 然后,您必須創建所有這些CSS樣式表,但這並不難。
一種替代方法是在PHP中創建CSS頁面,以便您可以將變量傳遞給單個表單來確定樣式。
<link rel=StyleSheet href="styles.php?theme=<?php echo $userCSSchoice; ?>" type="text/css" media=screen>
然后,您的PHP / CSS頁面可以確定顏色/圖像。
<?php
header("Content-Type: text/css");
if (isset($_REQUEST['theme']))
$theme = $_REQUEST['theme'];
else
$theme="default";
$bgImage="images/bg_".$theme.".png";
if ($theme=="default")
$mainColor="0f8200";
else if ($theme=="green")
$mainColor="009900";
?>
body {
background:url('<?php echo $bgImage; ?>') repeat-x #<?php echo $bg; ?>;
color: #<?php echo $mainColor; ?>;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.