Include the content from other webpages: Difference between revisions
Jump to navigation
Jump to search
| Line 22: | Line 22: | ||
* the code of "Click event" should written in the loaded file. | * the code of "Click event" should written in the loaded file. | ||
= | = Server-side approach = | ||
== Apache == | == Apache == | ||
* [http://httpd.apache.org/docs/1.3/howto/ssi.html Server side includes][http://dob.tnc.edu.tw/themes/old/showPage.php?s=1997&t=3&at=]({{Acronym | acronym=SSI | def=Server Side Include}}) | * [http://httpd.apache.org/docs/1.3/howto/ssi.html Server side includes][http://dob.tnc.edu.tw/themes/old/showPage.php?s=1997&t=3&at=]({{Acronym | acronym=SSI | def=Server Side Include}}) | ||
== CMS software or Wiki softwares == | |||
CMS softwares | |||
* [https://pantheon.io/decoupled-cms Decoupled CMS: Why “Going Headless” Is Becoming So Popular | Pantheon] {{access | date=2017-09-12}} | |||
Wiki softwares | |||
* [[DokuWiki]]: [[DokuWiki export]] or use the plugin [https://www.dokuwiki.org/plugin:getraw plugin:getraw] | |||
* Mediawiki: | |||
** [[MediaWiki Template]] or transclude syntax([[Mediawiki formatting rules]]) | |||
** 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 | |||
Other softwares | |||
* [[MovableType]]: template modules, or [http://www.sixapart.com/pronet/plugins/plugin/multiblog.html MultiBlog] plugin | |||
== PHP require / include function == | == PHP require / include function == | ||
| Line 40: | Line 54: | ||
** Using CONSTANT parameter (such as absolute file path in common configuration file) in the included path NOT using relative path | ** Using CONSTANT parameter (such as absolute file path in common configuration file) in the included path NOT using relative path | ||
** [http://antbsd.twbbs.org/~ant/wordpress/?p=3966 Resolving PHP Relative Paths Problems - Ant's ATField] | ** [http://antbsd.twbbs.org/~ant/wordpress/?p=3966 Resolving PHP Relative Paths Problems - Ant's ATField] | ||
= further reading = | = further reading = | ||
Revision as of 12:21, 12 September 2017
Multiple approaches for including the content from other webpages
usage
- seperate the navigation and content into two parts
- 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
- general (JavaScript Tip: Page Headers And Footers)
<script language="JavaScript" type="text/javascript" src="path/to.js"></script> <noscript><a href="URL">Description</a><noscript>
jQuery .load() or jQuery.ajax()
- the code of "Click event" should written in the loaded file.
Server-side approach
Apache
CMS software or Wiki softwares
CMS softwares
- Decoupled CMS: Why “Going Headless” Is Becoming So Popular | Pantheon [Last visited: 2017-09-12]
Wiki softwares
- DokuWiki: DokuWiki export or use the plugin plugin:getraw
- Mediawiki:
- MediaWiki Template or transclude syntax(Mediawiki formatting rules)
- Include the content of wiki page from other software API:FAQ - MediaWiki ex: https://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1 [Last visited: 2016-02-16]
- Oddmuse wiki: Transclusion means to include a wiki page from elsewhere into your current page
Other softwares
- MovableType: template modules, or MultiBlog plugin
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
- solution:
- Using CONSTANT parameter (such as absolute file path in common configuration file) in the included path NOT using relative path
- Resolving PHP Relative Paths Problems - Ant's ATField
further reading
- Boutell.Com, Inc. (2007). How Do I Include One HTML File in Another? / Jennifer Kyrnin (n.d.). [2]
- How to include an html page into an html page