google code prettify를 이용하였다.
Blogger에 Google Code Prettifier 추가
다음 자바스크립트를 복사하여 템플릿 편집페이지에 붙여넣는다.<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"> </script>
1. 왼쪽 사이드의 템플릿 클릭
2. HTML 편집 버튼 클릭
3.태그를 검색하여 앞에 붙여넣기
PHP 코드 삽입
포스트에 PHP 코드를 삽입하여 보자.<?php /* * Site : http:www.smarttutorials.net * Author :muni * */ define('BASE_PATH','http://localhost/copypaste/'); define('DB_HOST', 'localhost'); define('DB_NAME','copypaste'); define('DB_USER','root'); define('DB_PASSWORD',''); $con=mysqli_connect( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } ?>먼저 html to xml parser tool을 이용하여 코드를 변환한다.
포스팅 할 때 변환한 코드를 <pre class='prettyprint'>...</pre>태그 사이에 붙여 넣으면 된다.
<pre class='prettyprint'> ..... </pre>
기타
템플릿의 헤더에 추가하는 스크립트에 skin을 지정할 수 있다.
(본 블로그에 사용된 skin은 desert이다.)
더 자세한 내용은 wiki를 참조하라.
댓글 없음:
댓글 쓰기