http://findicons.com/icon/47126/facebook
有很多各种大小,格式的 icon 图标。做网站的用得到。
所有的鸟儿他们都知道, 他们的巢应该筑在什么地方, 鸟儿知道自己该在什么地方筑巢, 那就意味着他们了解他们自己的使命。 我们身为万物之灵的人类, 怎么会不知道,连鸟儿都知道的道理呢?
很多时候我们用 ajax 技术来异步更新,做到无刷新的效果。
但是很多时候还要考虑浏览器未开启javascript的情况, 这个时候我们会为没有开启javascript的情形重新编写一种处理。
这就导致可能会出现一个功能的两种实现。 但是从下面的jquery官方例子我们还是会有收获的。
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
<form action="/" id="searchForm">
<input type="text" name="s" placeholder="Search..." />
<input type="submit" value="Search" />
</form>
<!-- the result of the search will be rendered inside this div -->
<div id="result"></div>
<script>
// attach a submit handler to the form
$("#searchForm").submit(function(event) {
// stop form from submitting normally
event.preventDefault();
// get some values from elements on the page:
var $form = $( this ),
term = $form.find( 'input[name="s"]' ).val(),
url = $form.attr( 'action' );
// Send the data using post and put the results in a div
$.post( url, { s: term } ,
function( data ) {
var content = $( data ).find( '#content' );
$( "#result" ).html( content );
}
);
});
</script>
</body>
</html>
用过asp.net的母版页的人应该感觉这个东西还是有值得php借鉴的地方。
新出来的 smarty 3 引入了 Template Inheritance 概念,能和asp.net 的母版页实现同样的功能。
Example 15.6. Template inheritance example
layout.tpl (parent)
<html> <head> <title>{block name=title}Default Page Title{/block}</title> {block name=head}{/block} </head> <body> {block name=body}{/block} </body> </html>
myproject.tpl (child)
{extends file='layout.tpl'} {block name=head} <link href="/css/mypage.css" rel="stylesheet" type="text/css"/> <script src="/js/mypage.js"></script> {/block}
mypage.tpl (grandchild)
{extends file='myproject.tpl'} {block name=title}My Page Title{/block} {block name=head} <link href="/css/mypage.css" rel="stylesheet" type="text/css"/> <script src="/js/mypage.js"></script> {/block} {block name=body}My HTML Page Body goes here{/block}
To render the above use
$smarty->display('mypage.tpl');
The resulting output is
<html> <head> <title>My Page Title</title> <link href="/css/mypage.css" rel="stylesheet" type="text/css"/> <script src="/js/mypage.js"></script> </head> <body> My HTML Page Body goes here </body> </html>