作者 主題: 讓blogger可以貼html程式碼  (閱讀 3356 次)

0 會員 與 1 訪客 正在閱讀本文。

夢無痕

  • 懷疑的國中生
  • **
  • 文章數: 50
    • 檢視個人資料
    • 阿榮哥的人~蔘~
讓blogger可以貼html程式碼
« 於: 2010-04-16 14:25 »
我想讓我的google的blogger可以貼程式碼
就像這個http://keikoblog.blogspot.com/2009/03/blog.html這樣
我已經在blooger範本輸入了
代碼: [選擇]
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>

然後貼一個文章測試
代碼: [選擇]
<pre class="brush: html;">
<html><body>
test
</body></html>
</pre>
為什顯示卻只有這樣
test
照常理講因該要顯示
<html><body>
test
</body></html>

除非要
轉換成
&lt;html&gt;&lt;body&gt;
test
&lt;/body&gt;&lt;/html&gt;
才可以正常顯示
我有提供我的網址
http://a-rong-go.blogspot.com/2010/04/blog.html
請問有高手可以為我解惑嗎


« 上次編輯: 2010-04-16 18:02 由 夢無痕 »
~人逢順境不逞強,身處逆境不示弱~
小弟的部落格- http://a-rong-go.blogspot.com/

see7di

  • 懷疑的國中生
  • **
  • 文章數: 51
  • 性別: 男
    • 檢視個人資料
    • http://7di.net
回覆: 讓blogger可以貼html程式碼
« 回覆 #1 於: 2010-05-02 22:34 »
因为在发贴的时候使用了php的script_tag函数把html的meta标签都给过滤掉了,这是错误的,同样的错误我在yahoo的blog也见过,这种过滤是错误的
解决方法很简单,只需要使用htmlspecialchars函数即可