You are not logged in.

Announcement

Forum database was corrupt and an old backup was restored as temporary replacement. Registrations closed until the database is recovered. Please ask questions using the Contact form

#1 23-06-2014 15:10:37

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

PHP Variables Question

I have a page skeleton....


<?php
$subNav = array();

set_include_path("../");
include("inc/essentials.php");

/*Include a sidebar */
include_once("inc/sidebar.php");
showSidebar("connect");

?>

<script>
$mainNav.set("Connect")
</script>


<body>
<?php echo "Device:".$device; ?>
</body>   



$device returns blank?


Am I doing something wrong?

Offline

#2 23-06-2014 16:51:23

rsalomone
Contributors
Registered: 22-11-2013
Posts: 101
Website

Re: PHP Variables Question

After reading several threads on $device, I discovered that the PHP variables are not available on pages. 


Here is an example:

<div id="column1">
some stuff in here
</div>

<div id="column2">
some stuff in here
</div>

The preferred solution would allow me to:

<div id="column1">
some stuff in here

{if the device is not mobile or mobileOnDesktop then....
   </div>
   <div id="column2">
}

some stuff in here
</div>

Any ideas?

Offline

#3 23-06-2014 20:18:11

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: PHP Variables Question

PHP variables are indeed not available on subpages (due to the dynamic loading). Javascript variables are available. You can also detect the device by checking the css of the body.  (device is attached as a class to it)

Offline

Board footer

Powered by FluxBB