Changeset 33741 in project
- Timestamp:
- 11/13/16 10:07:23 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/4/awful
r32309 r33741 1553 1553 been introduced in awful version 0.40.0. 1554 1554 1555 Note that {{$db}} is supposed to be used in the context of request 1556 handlers (i.e., in the body of a lambda bound to a uri path by 1557 {{define-page}}). 1558 1559 If you want to use {{$db}} out of the context of request handlers, 1560 you'll have to manage database connections yourself. Basically, you 1561 have to parameterize {{db-connection}} with the actual connection 1562 object. Example: 1563 1564 <enscript highlight=scheme> 1565 (parameterize ((db-connection (open-database (db-credentials)))) 1566 ($db the-query) 1567 (close-database (db-connection))) 1568 </enscript> 1569 1555 1570 1556 1571 ===== {{$db-row-obj}} … … 1581 1596 1582 1597 ===== {{define-page}} 1583 <procedure>(define-page path-matcher handler #!key css title doctype headers charset no-ajax use-ajax no-template no-session no-db no-javascript-compression method use-sxml strict)</procedure>1598 <procedure>(define-page path-matcher handler #!key css title doctype headers charset no-ajax use-ajax no-template no-session no-db no-javascript-compression method use-sxml vhost-root-path strict)</procedure> 1584 1599 1585 1600 Define an awful page. … … 1591 1606 1592 1607 1593 {{handler}} should return either a string or a no-argument procedure. 1594 If it returns a string, it will be given as argument to 1595 {{(page-template)}}, unless {{no-template}} is not false. If 1596 {{handler}} returns a procedure (feature introduced in awful 0.35), 1597 awful won't do anything besides evaluating the returned procedure. It 1598 can be useful, for example, to serve static files out of the web 1599 server document directory (see the examples in this section). 1608 {{handler}} should return either a string, a no-argument procedure or 1609 a list (in case SXML mode is enabled -- SXML support has been 1610 introduced in awful 0.36). If it returns a string, it will be given 1611 as argument to {{(page-template)}}, unless {{no-template}} is not 1612 false. If {{handler}} returns a procedure (feature introduced in awful 1613 0.35), awful won't do anything besides evaluating the returned 1614 procedure. It can be useful, for example, to serve static files out 1615 of the web server document directory (see the examples in this 1616 section). If {{handler}} produces a list, awful or the particular page 1617 in question must be operating in SXML mode, which can be set via the 1618 {{enable-sxml}} parameter or via de {{use-sxml}} keywork parameter for 1619 {{define-page}}. The list produced by the handler will be given as 1620 argument to the procedure yield by the {{sxml->html}} parameter. 1600 1621 1601 1622 {{use-sxml}} (boolean): specifies whether awful should assume that the … … 1634 1655 not {{#f}}. 1635 1656 1657 {{vhost-root-path}} (a string or {{#f}}) is the root path of the 1658 virtual host the page definition is to be applied to. If 1659 {{vhost-root-path}} is set to a path, the page definition will only be 1660 valid for the virtual host whose root path is the given path. 1661 1636 1662 If {{strict}} is truthy, awful will only match the requested path if 1637 1663 it strictly matches the defined matchers. For convenience, awful … … 1649 1675 {{(irregex "/[^/]*")}}, even if the regex specified that paths with a 1650 1676 trailing slash should not match. 1651 1652 1677 1653 1678 Examples: … … 1802 1827 1803 1828 Generate JavaScript code to be added to the page defined by 1804 {{define-page}}. Return the generated JavaScript code (which usually 1805 is not useful, so should be discarded). 1829 {{define-page}}. Return the generated JavaScript code. Unless 1830 {{no-page-javascript}} is a truthy value, the JavaScript code will be 1831 added to the page in which case the returned JavaScript code is 1832 usually not useful and can be discarded. 1806 1833 1807 1834 {{path}} is the URL path (a string) of the server side handler. This … … 1941 1968 jQuery.ajax 1942 1969 ([[http://api.jquery.com/jQuery.ajax/|http://api.jquery.com/jQuery.ajax/]]). 1970 1971 The {{no-page-javascript}} keyword parameter is a boolean that 1972 determines whether the generated JavaScript code is automatically 1973 added to the page or not. Defaults to {{#f}}. This parameter may be 1974 useful if you want more control of where or when the generated 1975 JavaScript code gets added to the page or even if it gets added at 1976 all. 1943 1977 1944 1978 The {{ajax}} procedure is session, HTTP request and database -aware. … … 3155 3189 === License 3156 3190 3157 Copyright (c) 2010-201 4, Mario Domenech Goulart3191 Copyright (c) 2010-2016, Mario Domenech Goulart 3158 3192 All rights reserved. 3159 3193
Note: See TracChangeset
for help on using the changeset viewer.