Include the content from other webpages: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
Line 46: Line 46:
* Mediawiki:  
* Mediawiki:  
** [[MediaWiki Template]] or transclude syntax([[Mediawiki formatting rules]])
** [[MediaWiki Template]] or transclude syntax([[Mediawiki formatting rules]])
** Obtain the content of wiki page from other software [https://www.mediawiki.org/wiki/API:FAQ#get_the_content_of_a_page_.28HTML.29.3F API:FAQ - MediaWiki] ex: https://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1 {{access | date = 2016-02-16}}
** Include the content of wiki page from other software [https://www.mediawiki.org/wiki/API:FAQ#get_the_content_of_a_page_.28HTML.29.3F API:FAQ - MediaWiki] ex: https://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1 {{access | date = 2016-02-16}}
* [[Oddmuse wiki]]: [http://www.oddmuse.org/cgi-bin/wiki/Transclusion Transclusion] means to include a wiki page from elsewhere into your current page
* [[Oddmuse wiki]]: [http://www.oddmuse.org/cgi-bin/wiki/Transclusion Transclusion] means to include a wiki page from elsewhere into your current page



Revision as of 15:22, 16 February 2016

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
    • 缺點是瀏覽器上的鏈結,非該篇網頁的靜態鏈結。
    • 額外需要處理的議題:(1)點選連結,內容會直接顯示在 frame 內,如果 frame 太小,會需要額外處理。例如:frame內的連結,以新視窗開啟。(2)Iframes and CSS - Styling Iframes With CSS
    • 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