View library
The view library extends the XML library.
Properties
- mode (rw): Output mode: null, "ajax", "xml", "json", "restxml", "restjson".
- language (rw): Value of the language META tag in the HTML output.
- description (rw): Value of the description META tag in the HTML output.
- keywords (rw): Value of the keywords META tag in the HTML output.
- title (rw): Value of the TITLE tag in the HTML output
- inline_css (rw): Value of the STYLE tag in the HTML output.
- content_type (rw): Value of the Content-Type META tag in the HTML output.
- layout (r): The layout stylesheet Banshee uses to render the HTML output. Possible sheets are views/includes/layout_*.xslt.
- disabled (r): Tells whether Banshee will use the XSLT view or not. If disabled, all printed output will be send to the browser.
- mobile (r): Tells if Banshee has detected a browser on a mobile phone or tablet.
Methods
- disable():
Disable the view library. All printed data will be sent to the client. - allow_hiawatha_cache():
When using the Hiawatha webserver, you allow it to cache the output. - add_css($css):
Add CSS file located in public/css to HTML output. - add_javascript($script):
Add Javascript located in public/javascript to HTML output. - run_javascript($code):
Run Javascript code upon HTML page load in browser. - add_alternate($title, $type, $url):
Add alternate LINK tag to HTML output. - set_layout($layout):
Use the layout file "view/banshee/layout_".$layout.".xslt". - add_system_message($message):
Print message in green bar at top of HTML output. - add_system_warning($warning):
Print warning in red bar at top of HTML output. - add_message($message):
Add message to message buffer which can be shown via <xsl:call-template name="show_messages" />
Example
<?php
$this->view->add_css("example.css");
$this->view->title = "Item list";
$this->view->open_tag("list");
$this->view->add_tag("item", "Item 1");
$this->view->add_tag("item", "Item 2");
$this->view->add_tag("item", "Item 3");
$this->view->close_tag();
?>