CMS MADE SIMPLE FORGE

BrowserTools

 

[#5298] You cannot use assign and isMobile together

avatar
Created By: Russ Baldwin (russ)
Date Submitted: Fri Aug 13 11:02:00 -0400 2010

Assigned To: Jeremy Bass (jeremybass)
Version: RC 0.6
CMSMS Version: None
Severity: Minor
Resolution: None
State: Open
Summary:
You cannot use assign and isMobile together
Detailed Description:
You cannot use assign and isMobile together, so if you want todo something
simple like this in a pages 'Page Specific Metadata':

{browsertools action="isMobile"  assign=isMobileDevice}
{if ($isMobileDevice=='true')}
      {* I'm a Mobile device  - Let's Dance*}
{else}
     {* I'm NOT Mobile  - Let's Sleep *}
{/if}

But you can is you make these changes about line 918 - the code could probably
do with a bit of tiding up...

	//Changed by Russ Friday 13th 2010 to allow isMobile and Assign together
		if($action=='isMobile') 
		{
		$assign = isset($params['assign']) ? $params['assign']:false;
			if( $browser->isMobile()) {
			    //return 'true';
			$outputting = 'true';
				if($assign!=false)
				{
					$smarty->assign($assign,$outputting);
					return;
				}else{
					return 'true';	
				}
				
			}else{
				//return 'false';
					$outputting = 'false';
					if($assign!=false){
						$smarty->assign($assign,$outputting);
						return;
					}else{
						return 'false';	
					}
			}
			
		}
		

Hope this helps Jeremy, they maybe a better way of achieving the same thing, if
so please let me know ;-)

Russ


History