Maison >développement back-end >tutoriel php > 用PHP在主页MAIN.PHP中让用户自定义添加内容,有码求帮助
用PHP在首页MAIN.PHP中让用户自定义添加内容,有码求帮助
以下代码肯定有问题,试过了,我刚入门,求各位帮助!
我的思路是这样的:
先在MAIN.PHP中输入所有自定义内容的HTML代码,譬如用户可以自定添加至多2个内容快,A和B,我先在主页中写:
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <div id="<?php echo $widgets1 ?>"> A </div> <div id="<?php echo $widgets2 ?>"> B </div> 然后在CSS中设置: [code=CSS] #a { display:none; } #b { display:none; } #a1 { } #b1 { }
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> if(isset($_COOKIE['events'])) { $widgets1 = $_COOKIE['events']; } else { $widgets1 = "eventsshow"; } if(isset($_COOKIE['friends'])) { $widgets2 = $_COOKIE['friends']; } else { $widgets2 = "friendsshow"; }?>