|
|||||||
1. Introduction
2. Installing Karrigell 3. The Web server 4. Configuration options 5. Working with Apache, LightTPD or Xitami 6. Programming 7. Debugging 8. Python scripts 9. CGI scripts 10. Karrigell Services 11. Python Inside HTML 12. HTML Inside Python 13. HTMLTags - generate HTML in Python 14. Including documents 14.1 Namespace 14.2 Passing parameters 15. Sessions 16. Authentication 17. Translation and Unicode |
14. Including other documents or scriptsInside a script you can ask Karrigell to include the content of another static file or the output of another script by theInclude(url)
function, where url is the url of the file or script
(you can use aliases as for ordinary files)
This is useful if you want to build a set of pages with components which will be present in each page (for instance a header and/or a footer). Your script will be built this way :
At runtime, Karrigell will raise a RecursionError in case of loops (scripts that include themselves, or script 1 includes script 2 which includes script 1) 14.1 NamespaceAn included script is run in the same namespace as the script which "calls" it, including the variables defined in this script : if the caller script is
and whoseName.py is
you'll see that the 14.2 Passing parametersIt can be useful to pass parameters to an included script : see for instance the menu script in the personal portal demo. This script takes as parameters a list of menu items and the list of matching urlsIt will be included this way :
Parameters can also be passed in the query string appended to the script
url : with |