David Ansermot Web Developer / TYPO3 Integrator

16nov/110

TYPO3 – Auto assign not-logged feuser to a fegroup

In today's short snippet, I'll give you the easiest way I now to to assign a fegroup to your visitors, without login.

1- Begin by creating your FEgroup if not done yet.
2- In your localconf.php, for exemple, add those lines :

  1. $ip = $_SERVER['REMOTE_ADDR'];
  2. $GLOBALS['TYPO3_CONF_VARS']['FE']['IPmaskMountGroups'][] = array($ip, GROUPID);

3- Replace "GROUPID" by the id of the FEgroup.

Now all your visitors are members of this FEgroup.

Enjoy !

14avr/110

Javascript – Test if variable is numeric

Here's a simple way to check if a variable is numeric or not in javascript

  1. function isNumeric(input) {
  2.         return (input - 0) == input && input.length > 0;
  3. }

Enjoy

25fév/110

HowTo Detect SSL in PHP

Here's a little function I had to use today to detect SSL for payments.
It detects if SSL is on, if not, it redirect the user to the SSL url.

  1. if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
  2.         $domain = 'https://'.$_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  3.         header('Location: '.$domain);
  4.         exit;
  5. }

Enjoy

3mar/100

JS – setInterval tip

You want to use the Javascript function setInterval() but you dont know how ?
Or you tried but it doesn't work ?

I think you do the thing like this :

var timerId = setInterval('myFunction', 200);

but it doesn't works.
Try like this :

var timerId = setInterval(function() { myFunction(); } , 200);

Hope this snippet helps you.
See ya !