-
Notifications
You must be signed in to change notification settings - Fork 9
Dwoo based frontend templates
We are using Dwoo as our default template engine. It is quite easy to move from the old PHPlib templates used in WebsiteBaker to the new Dwoo engine.
Instead of direct function calls, for example
page_content()
or
<?php page_content() ?>
use
{page_content()}
without the <?php ?>
. So, just add {}
to the function call and remove <?php ?>
and you're done.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
{get_page_headers()}
</head>
<form action="{$LOGIN_URL}" method="post">
<input type="hidden" name="username_fieldname" value="{$username_fieldname}" />
<input type="hidden" name="password_fieldname" value="{$password_fieldname}" />
<fieldset class="account_form">
<legend class="account_legend">{translate('Login')}</legend>
{if $message}<div class="account_message">{$message}</div>{/if}
<label class="account_label" for="{$username_fieldname}">{translate('Username')}:</label>
<input type="text" class="account_input" name="{$username_fieldname}" id="{$username_fieldname}" maxlength="30" /><br />
<script type="text/javascript">
var ref= document.getElementById("{$username_fieldname}");
if (ref) ref.focus();
</script>
<label class="account_label" for="{$password_fieldname}">{translate('Password')}:</label>
<input type="password" class="account_input" name="{$password_fieldname}" id="{$password_fieldname}" maxlength="30" /><br />
<input type="submit" class="account_button" name="submit" value="{translate('Login')}" />
</fieldset>
</form><br />
<a href="{$FORGOT_URL}">{translate('Forgot your details?')}</a>
get_page_footers()
completely replaces the old method register_frontend_modfiles_body()
.
Just add the function call directly before the closing </body>
-Tag of the template:
<html>
<head>
...more...
</head>
<body>
...
<?php get_page_footers(); ?>
</body>
</html>
Or, for Dwoo based templates:
{get_page_footers()}
For backend templates (which are always Dwoo based), use
{get_page_footers('backend')}
The function is backward compatible and automatically loads the following files of all modules used on the current page:
<Module>/frontend_body.js
In addition, every module can have a file named footers.inc.php
to define additional files.
The basics are the same as described in get_page_headers(). The file should define an array named $mod_footers
.
Of course, neither CSS files can be loaded nor META-settings can be made in the footer. But it is possible to load additional JavaScripts here.
Example:
$mod_footers = array(
'frontend' => array(
'script' => array(
array(
'alert("hello world!");'
),
),
),
);