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

using php in Xerte

Plus d'informations
il y a 6 ans 7 mois #6215 par rloenen
using php in Xerte a été créé par 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

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 6 ans 7 mois #6217 par tom
Réponse de tom sur le sujet 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?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 6 ans 7 mois #6218 par rloenen
Réponse de rloenen sur le sujet 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>

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: ingdon
Temps de génération de la page : 0.166 secondes
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo