Let me begin by saying that my knowledge of PHP is limited at best, so I am not really sure if what I have tried is correct.
Essentially, I need PHP to run a specific script depending on a variable (language in this case). From what I have found online, this requires the use of a switch statement, but it doesn't seem to run properly. Below is the beginning of the code
<?php
$lang = "en-US";
switch ($lang) {
case "en-US":
<script type="text/javascript">
(function() {
var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
se.src = '//storage.googleapis.com/code.rival.com/js/3ca9-4824-43d0-81ec-0c04fb80901b.js';
var done = false;
se.onload = se.onreadystatechange = function() {
if (!done&&(!this.readyState||this.readyState==='loaded'||this.readyState==='complete')) {
done = true;
}
};
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
})();
</script>
;
break;
case "de-DE":
<script type="text/javascript">
(function() {
var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
se.src = '//storage.googleapis.com/code.rival.com/js/d8d2-9653-427d-bcb6-13e135d6195e.js';
var done = false;
se.onload = se.onreadystatechange = function() {
if (!done&&(!this.readyState||this.readyState==='loaded'||this.readyState==='complete')) {
done = true;
}
};
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
})();
</script>
;
break;
There is a fair bit more code, but I didn't want to place a wall of code here. The default at the end uses the same JavaScript as "case "en-US"".
I hope the problem makes sense.