Author:
phoque
Version:
1.1
Release Date:
18 Mar 2011
Category:
Forms

Description

This utility injects a author login-form on every page when two conditions are fullfilled:

  1. Event login-info is attached to the page
  2. User is not logged in

Otherwise, the regular templates will be executed. This provides a handy, site-wide login-check without the need of custom XSLT everywhere you want to use it.

XSLT

View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- 
It is very important that you are using <xsl:include /> instead of 
<xsl:import /> to include this template, otherwise this util will not work!

Background: templates in an imported stylesheet will be overwritten by
templates in the current stylesheet while the ones being included will not.

This util assumes that your master matches "/" and your page matches "data".
-->

<xsl:template match="data[events/user/@logged-in = 'false']">
	<form action="{$root}/symphony/" method="post">
		<label>Username
			<input name="username" type="text" />
		</label>
		<label>Password
			<input name="password" type="password" />
		</label>
		<input name="action[login]" type="submit" value="Login" />
		<input name="redirect" type="hidden" value="{$current-path}" />
	</form>
</xsl:template>

</xsl:stylesheet>

Discuss this XSLT Utility

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details