2Code
Posts: 24
|
Posted: 02/09/2014, 11:10 PM |
|
I am new to code charge and I must say its a very well put together program.... I do have a question that hopefully can benefit all users..
OK here we go....
I have 2 includable pages on a index.php. and around those includeables I have labeled like this.
<body>
<!-- BEGIN Panel FC -->{FlashContent}<!-- END Panel FC -->
<!-- BEGIN Panel MSC -->{MobileContent}<!-- END Panel MSC -->
</body>
now i did some digging to find this code below..
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($iphone || $android || $palmpre || $ipod || $berry == true)
{
echo "<script>window.location='http://m.site.com'</script>";
}
........
if i put the code above in the bottom of my common or in the bottom of my index.php it works perfect and redirects...
my question in this crazy concept is how can I base it on the panels
example
is there a way to add this to the panel and show or hide based on
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if a user is coming from a desktop it shows only FC panel and if they are on a mobile it shows only MSC panel????
i am new to CCS but I have been at this for 4 days with nothing yet I would like to pick the minds of the community to see how we can get this to work..
|
|
|
eratech
Posts: 513
|
Posted: 02/10/2014, 3:53 PM |
|
If you are looking to make one panel visible/not visible, then try adding something like the code to the Page 'Before Show' event:
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
.....
if ($iphone || $android || $palmpre || $ipod || $berry == true) {
$thispagename->FC->Visible = false;
$thispagename->MSC->Visible = true;
} else {
$thispagename->FC->Visible = true;
$thispagename->MSC->Visible = false;
}
Depending on how you like code to be stored, you could put something similar in the Panel 'Before Show' as well. There are several places to put the code, but they are all similar in effect.
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
|