This is the place for questions about learning design and pedagogy; how to use different page types for different purposes.

using php in Xerte

  • rloenen
  • Onderwerp Auteur
  • Offline
  • Premium lid
  • Premium lid
Meer
6 jaren 7 maanden geleden #6215 door rloenen
using php in Xerte werd gestart door rloenen
Sometimes I want to use php to detect the type of device to forward to another site. How is that possible in Xerte?
Ronald

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
6 jaren 7 maanden geleden #6217 door tom
Beantwoord door tom in topic using php in Xerte
You cannot use php for that in Xerte. A Xerte LO is purely client-side based, so you would need to accomplish the same in javascript.

Wat kind of devices would you like to be able to detect?

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

  • rloenen
  • Onderwerp Auteur
  • Offline
  • Premium lid
  • Premium lid
Meer
6 jaren 7 maanden geleden #6218 door rloenen
Beantwoord door rloenen in topic using php in Xerte
Some lo's are specially made for a mobile and have a different version for laptops. This has to do with the size of images and tables or too many tabs for a mobile to keep a clear screen.
I have solved this by the opening off my site and immediately detect what the device is and from there to go to other menu pages that again refer to other lo's.
So it is solved.
For them who want to know how I did it the script. It seems to work well so far
vo-xerte.php is my menusite
vo-xerte_m.php is my menusite for mobiles.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>soort device</title>
</head>

<body>
<?php
function checkDevice() {
// checkDevice() : checks if user device is phone, tablet, or desktop
// RETURNS 0 for desktop, 1 for mobile, 2 for tablets

if (is_numeric(strpos(strtolower($_SERVER), "mobile"))) {
return is_numeric(strpos(strtolower($_SERVER), "tablet")) ? 2 : 1 ;
} else {
return 0;
}
}

$deviceType = checkDevice();
if ($deviceType==0) {
header('Location: vo-xerte.php');
} else if ($deviceType==1) {
header('Location: vo-xerte_m.php');
} else {
header('Location: vo-xerte.php');
}
?>
</body>

</html>

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Moderators: ingdon
Tijd voor maken pagina: 0.207 seconden
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo