Include the content from other webpages: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
Line 20: Line 20:


== jQuery ==
== jQuery ==
* [http://api.jquery.com/load/ .load()]
[http://api.jquery.com/load/ .load()]
* the code of "Click event" should written in the loaded file.


= server-side approach =
= server-side approach =

Revision as of 18:49, 3 June 2013

Multiple approaches for including the content from other webpages

usage

  1. seperate the navigation and content into two parts
  2. compare the content from two webpages

client-side approach

frame or iframe

  • frame or iframe tag, object tag
    • 缺點是瀏覽器上的鏈結,非該篇網頁的靜態鏈結。
    • cross frame layers


javascript

<script language="JavaScript" type="text/javascript" src="path/to.js"></script>
<noscript><a href="URL">Description</a><noscript>


jQuery

.load()

  • the code of "Click event" should written in the loaded file.

server-side approach

Apache


PHP require / include function

PHP require_once(), include function ...

troubleshooting:

  • (When I browsed some_file.php which include )Warning: include_once(lib.php) [function.include-once]: failed to open stream: No such file or directory in ...common/view.php
common/lib.php
common/view.php  //the file included common/lib.php
some_file.php    //the file included common/view.php

wiki softwares

other software

other software

further reading