Archive for the ‘網頁’ Category
手快殘廢了
專題研究輪站課程結束了,下學期組別也都選好了,我選了資訊。除了地科只有 9 個人以外,其他人數都很平均。下星期就要考專題研究的期末考了,得好好準備一下。若不及格會被踢出數理班。不過這次考試應該不會太難,資訊、數學都有發題庫練習。考完專研又有期末考,打算用連假把書念一念。
今天晚上花了一堆時間修圖書館的網頁,因為實在太慢了。原始碼根本不堪入目,圖檔也沒壓好。一堆標籤亂用(特別是 <font>),CSS 幾乎沒有用到,很可惜。經過一番整頓候,網頁小很多,而且還變成合格的 HTML 4.01 Transitional。還有很多地方可以用 CSS 取代,但懶得弄了。現在打 code 打到手快殘廢了,累死人了。
用 Apache 的 mod_deflate(或 mod_gzip) 壓縮檔案會使網頁的大小縮很多,有時候甚至可以少掉 50%,但似乎很少人在用。這次網頁的大小就從 33 KB 壓到 6 KB。還有 PNG 圖檔通常比 GIF 小,所以很多網頁已經開始轉向使用 PNG 了。而且 GIF 其實有版權,所以市面上可以製作 GIF 檔的軟體都含有用費用,不過一般人不會注意。
最近終於將討論區弄好,但怎麼都沒人去啊?我弄得很辛苦!!!
殘廢
話說上星期五,我真的是蠢死了。我和學長為了修改某個網頁,眼睛盯了螢幕很久,但一直找不出問題。最後發現 HTML 中的路徑看錯了…不小心將 news/bulletin/board/bulletin.php 看成 /news/bulletin/board/bulletin.php。兩個根本是天壤之別。唉,說到網頁,現在網管好像也沒有人會 PHP,所以有點很麻煩。
目前正在學 FreeBSD 當中。這星期電腦課,我在實驗機灌了 2 個 Apache,所以變成有 3 個。強吧?結果 port 80 被佔用,我恢復不了,因此只好重灌 FreeBSD。不過 FreeBSD 安裝很快,不用 15 分鐘就弄好了。希望下次社課能夠架好 Apache + PHP + MySQL + FTP。至於 SMTP server 以後再說。
今天下午下樓梯時腳又扭傷了,讓我想起國三也曾經發生過一次。那時候連走路都很困難,這次也一樣。大概要一段時間才會好。
Trying to use PHP
Over the past few weeks I have been idle because of all the exams and homework. The class website needs to be updated, and I recently came up with a new idea of creating a website including Chinese poems (詩) , ci (詞), and qu (元曲). This time PHP will be a new ingredient, but it probably will be pretty basic since I don’t know much about it.
Embedding Flash
Ever since Alex and I started using valid code for websites, we have been searching for a way to embed Flash properly. The most common way we see is probably the built-in method in Dreamweaver.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash"> <param name="movie" value="../media/Flash.swf" /> <param name="quality" value="high" /> <embed src="./file.swf" quality="high" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed> </object>
In this code, different elements are used for different browsers. <object> is used for Internet Explorer while <embed> is used by other browsers. IE recognizes <object> and uses it to display Flash, however, other browsers do not, so they ignore it and move on to use <embed> as an alternative.
Because <embed> was created by Netscape and is not part of the HTML specification, it will make your page invalid. Moreover, this method will not allow you to put any alternative text or images if the Flash fails to load.
After some time on the Internet, we found an effective method of embedding Flash (on this site) that supports all the major browsers we know of.
<!--[if IE]> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash"> < ![endif]--> <!--[if !IE]> < --> </object><object type="application/x-shockwave-flash" data="./file.swf" width="550" height="400" title="Flash"> <!--> < ![endif]--> <param name="movie" value="./file.swf" /> <param name="quality" value="high" /> <param name="pluginurl" value="http://www.adobe.com/go/getflashplayer" /> </object>
This method uses conditional comments, therefore, it can work on multiple browsers while having the same functions as the method used by Dreamweaver. The start of <object> was specifically meant for IE, so it is between <!--[if IE]> and <![endif]-->. Another variation of <object> for other browsers such as Mozilla Firefox is between <!--[if !IE]> <--> and <!--> <![endif]-->.
Another problem we have been trying to solve is we have to click on Flash objects in IE to activate them. It’s quite annoying, so we decided to get rid of it once and for all. We simply created a JavaScript file and included either the original or valid code by using document.write and added allowScriptAccess.
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash"><param name="movie" value="./file.swf" /><param name="quality" value="high" /><param name="allowScriptAccess" value="always" /><embed src="./file.swf" quality="high" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="always" width="550" height="400"></embed></object>');
Now the XHTML code is:
<script src="../scripts/Flash.js" type="text/javascript"></script>
Although JavaScript works in most browsers, some people prefer to block JavaScript, for it may be obtrusive. Therefore, we added the valid code within <noscript>:
<script src="../scripts/Flash.js" type="text/javascript"></script> <noscript> <div> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash"> < ![endif]--> <!--[if !IE]> < --> </object><object type="application/x-shockwave-flash" data="./file.swf" width="550" height="400" title="Flash"> <!--> < ![endif]--> <param name="movie" value="./file.swf" /> <param name="quality" value="high" /> <param name="pluginurl" value="http://www.adobe.com/go/getflashplayer" /> </object> </div> </noscript>
So far this code has worked well although editing things inside is tedious. Right now, I don’t know if Flash embedded this way will stream properly. Apart from this, I don’t think there will be any other problems.
Note:
<script>shouldn’t be placed within<p>, or else your page won’t validate.
Links:
A new site or another failure?
After I found some excellent templates on Thursday, I decided to start making my own website. I used to spend all my time on the class web, so I couldn’t make one for myself. I hope I can complete my site since I gave up on my previous try.
Great templates
While I was surfing the Net, I came to http://andreasviklund.com/, and I saw some awesome and free templates. They are great for beginners because the templates are all valid XHTML and CSS, and they are completely free. WordPress themes are also available.
A new beginning
I’ve been waiting ages for the winter break so I can start on a new website. I tried converting the class web to XHTML 1.0 Strict to improve my skills with XHTML, but I had difficulties, so I didn’t manage to convert them all. After learning a lot about XHTML and CSS in the past few months, I decided it is time to move on and start making a new website.
Class web results!!!
We got 1st place on the class web competition!!! It was a lot of hard work, but now it is worth it. You can see at results at:http://www.cmjh.tn.edu.tw/class_web/
Class web URL: http://163.26.11.175/326/
Forums URL: http://cmjhb4.co.nr/forums/
Blog URL: http://cmjhb4.wordpress.com/
Making a website
Although it sounds simple, it is a complex job. It is time-consuming, yet it is still worth it. Making the class web is tiring, but it should be pretty good when it is completed. Learning Flash would probably be one of the hardest things to do since it is the first time I have tried to create a website with it. Debugging will also a bit hard, since we are trying to meet the W3C standards. Embedding Flash was a major problem since the <embed> tag wasn’t valid HTML/XHTML. In the end, we had to search for one, and we managed doing it.