一向很喜欢Typecho博客程序的简约玲珑,用来做一句话博客或许生活博客最适合不过,而关于做一句话博客,完成typecho前台宣布的功用就更壮大了。搜刮了下,有网友给出了相干教程。
操纵步骤:
在当前主题的header.php文件或许index.php文件增加以下代码,完成前台宣布表单:
1234567891011
<?php if($this->user->hasLogin()): //推断是不是登录 ?> <div class="post"> <!--按个人CSS的变动--> <form action="<?php $this->options->siteUrl(); ?>action/contents-post-edit" method="post" name="write_post"> <input type="hidden" id="title" name="title" value="<?php echo date("Y-m-d H:i:s");?>" /><!--以宣布时间作标题,把这里的hidden改成text就能够自定义标题了--> <p><textarea name="text" cols="100" rows="4" id="text" autocomplete="off" onkeydown='countChar("text","counter");' onkeyup='countChar("text","counter");'></textarea></p><!--输入框--> <input type="hidden" id="allowComment" name="allowComment" value="1" checked="true" /><!--许可批评--> <input type="hidden" name="do" value="publish" /><!--公然,能够疏忽--> <input type="submit" class="pub" value="Send" /> </form> </div> <?php endif; ?>文章范例的挑选,在</form>前增加代码:
12345678910
<p> <input type="radio" name="format" id="format-post" value="post" checked="checked"> <label for="format-post">微博</label> <input type="radio" name="format" id="format-gallery" value="gallery"> <label for="format-gallery">图片</label> <input type="radio" name="format" id="format-video" value="video"> <label for="format-video">视频</label> <input type="radio" name="format" id="format-audio" value="audio"> <label for="format-audio">音乐</label> </p>
增加随机引导语,不需要可不增加:
12345678910
<?php $h2 = array( '随便说说', '随时随地分享身旁的新鲜事~', '来,说说你在想什么,做什么', '来搜狐微博看我', '嘀咕一下' ); ?> <h2><?php echo $h2[(array_rand($h2))]; ?></h2>
然后保留文件即可,输入表单的美化,本身经由过程增加CSS款式调解。
中心代码摘自:Ben’s Lab

评论列表