[frontend_render] Press escape to login

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
phalancs
Posts: 792
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

[frontend_render] Press escape to login

Post by phalancs » Fri 2. Mar 2012, 18:29

Simple frontend_render script to use the "escape" key to jump to the login.php (if not logged in yet)

Code: Select all

<?php 
//##################################################################
//
// 2012 - phalancs
//
// INSTALL:
// 1. put this code in a file like "escape_login.php"
// 2. put this file into template/inc_script/frontend_render/
//
// USAGE:
// On your site, simply press "escape" to jump to the login
// when already logged in, you'll land in the backend 
//
//##################################################################

$escape_login = ' 
<script type="text/javascript"> 
	<!-- 
	var triggerKeyCode = 27;
	jQuery(document).keyup(function(e) {
		if (e.keyCode == triggerKeyCode) {
			escape_login();
		}
	});
 
	function escape_login() {
  document.location.href="'.PHPWCMS_URL.$phpwcms["login.php"].'";	
        }	
        -->
</script>
';

//document.location.href="'.PHPWCMS_URL.$phpwcms["login.php"].'";
//	document.location.href="'.PHPWCMS_URL.'phpwcms.php";	
//insert script at the beginning after <body>
$content["all"] .= $escape_login;


?>
2008

Post Reply