Yii - Using two main layouts for desktop and mobile - mobile

I'm developing a simple app that will be used by desktops and mobile.
I'm trying to use this approach:
Before rendering the main action in the main controller I'm checking if the brower belongs to a "mobile" category (Using the plugin detecmobilebrowser detecmobilebrowser) then I need to switch to another flow (The actions available will be different) and for this actions I'll use a layout developed with jquery mobile to ensure the compatibility to different devices.
Using a:
$this->layout='//layouts/mobile';
changes the layout, but renders first main.php.
Is there a way to solve this without creating a new theme?
Thanks for your support

Related

Codename One, Possible to access photos without using Display.getInstance().openGallery()?

Is there are way for codenameone apps to access the images stored on the device programmatically and not using Display.getInstance().openGallery().
I want to construct my own gui for selecting images.
Thx
No. You can access these files as read only in a device specific way using native interfaces. Historically this wasn't possible technically in iOS and it was only possible to launch a picker UI to view the content of the camera roll.
For iOS the Photo's native API can be used https://developer.apple.com/documentation/photos?language=objc
It would require wrapping that with a native interface which is non-trivial https://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html

I have a angular website and want to use ionic to create the mobile apps. Whats the easiest way?

I have a website that is created in Angular 4 (with Lumen as the Rest API) that has a responsive design.
The website works on desktop & mobile browser fine but now I want to create the mobile applications.
What is the easiest way to wrap ionic around my existing Angular website to create the mobile applications? The mobile applications will need camera, location, bar-scanning, etc. So I cant just webkit or webview the mobile applications, I would need the plugins from ionic / cordova.
It depends if you want to use any Ionic Components, so if you want to make visual changes to your app, or not.
If you have already created your application and it works/looks fine on mobile, there is no need to use Ionic. Ionic provides visual components to build hybrid apps that look like native apps, but if you don't need them, there is no need to use Ionic. Instead you can just use cordova, which allows you to take your existing webapp and simply add the native features like camera, location, etc. to it.
If you want to change your app and give it a native feel with Ionic, then it really depends on what kind of app you have and how big it is. It's not an easy task to take your existing app and put it "inside" Ionic. It might be easier to just create a new project and copy over the logic, but rebuild everything UI related with Ionic Components.

Is Page Object Pattern suitable for Windows Application

I have read that Page Object Pattern is suitable for the Web Application Automation and I have used the Page object pattern with Selenium for one of the Web Apps I have automated.
How ever I am curious to know is Page Object suitable to Windows/Desktop applications ?. Though there is a scope in Windows Apps as well to create different Top level Windows as Pages and expose the operations as methods.
Has any one tried this and want to know the experiences/Advantages/disadvantages
The key equivalence here is page <=> dialog.
In a web app you encapsulate each page in a page object, while in a desktop app you encapsulate each dialog in an object that you might call a "dialog object".
The point is the encapsulation.
Over at my blog I've written about DRY page objects for testing web apps, but if you substitute dialog for page, it will apply equally well to dialog objects for desktop apps:
-- Keep Your Page Objects Clean and DRY
yes we can automate the desktop based application with Page object. you can refer WinAppDriverPageObjectModel

Reuse model and store from ExtJS in Sencha Touch

I already have an ExtJS app but now I'm trying to build a mobile version with Sencha Touch. I want the browser to detect if it's running on mobile or not. That works fine, but what is my next step?
I have it redirected to a /mobile folder with a new index.html and that works fine until I try to reach classes from a parent class.
Is it possible to load the mobile app.js instead of the extjs app.js in the primary index.html?
I don't think you will be able to get away with having just one application. Ultimately you would need to create two different apps - one using ExtJs framework, another using Sencha Touch.
Whether you will be able to share some code is a good question. I think you should be able to share models, but that's about it. And even though - I would not recommend doing that either. Because even if show similar information from the same back end in both full and mobile version of your application, you might not need all of it in the mobile application. And if you don't need all of it - your models will be different.

Use the plugins layout instead of the apps layout if it is available CakePHP

We have developed a CakePHP (1.3) application which works fine. Before usage users have to login. Nothing new there.
We also created a plugin containing a "sales website". It's styling is completely different from the applications design. The sales website works ok, but the loginpage is now based upon the applications layout (path: /users/login). We would like to apply the sales websites layout. But only when the plugin is available.
Is this possible? And if so, is it possible without the need to add a login method and/or users controller to the plugin?
You can use App::objects('plugin') to get a list of available plugins in your app. just do an array_search fro your plugin name and switch the layout accordingly

Resources