|
|||||||
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. Karrigell Services 10. Python Inside HTML 11. HTML Inside Python 12. HTMLTags - generate HTML in Python 13. Including documents 13.1 Namespace 13.2 Passing parameters 14. Sessions 15. Authentication 16. Translation and Unicode |
13. 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) 13.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 13.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 |