I'm developing an application with Symfony now, i need to detect user support (desktop or mobile ) and redirect with the same controllers to different templates twig views (for desktop or for mobile).
I can't use media queries, for the HTML and CSS files, i have to different folders, one for desktop files and other for mobile files.
If you haven't found a solution for your application, have you looked at suncat/mobile-detect-bundle? It has both PHP and Twig hooks.
Related
I used yii2 framework to do three sites, the three sites belonging to different servers, their layouts / main.php exactly the same, how to make these three different domain name website share this main.php?For example, a company's community and forums, as well as the official website are exactly the same layout file, which means that the three sites of the header and footer is the
same, according to my current practice, the three sites are writing this layout File and inside the style and pictures, then the problem occurs, if you want to change the footer and the title html, css, js or pictures, there will be three sites together, this is too much trouble. My current idea is to put the main.php file into one of the site's root directory, and then three sites in the frontend / layouts / main.php reference to the main.php inside the code, but how to do pictures and Style, please Experts advise?
You can include remote files using the allow_url_include directive, but this is a really bad idea because of the security risks.
In my opinion the way to go is to build a module with your layout-related files and then update it in the applications, using composer (or any other tool) when you make changes.
You could use a scaffolding like advanced template where different application (eg: backend and frontend) share common code .. Yii 2 Advanced Project Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers.
By default the advanced template includes three tiers: front end, back end, and console, each of which is a separate Yii application. front end and back end app share common namespace for models and config and you can extend for place a common layout or other application based on the same guidelines
This template is also designed to work in a team development environment. It supports deploying the application in different environments.
https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md
I'm already running a desktop website with views and template files. Now I would like to develop a mobile version of my website.
I've already detect smart devices by using WURFL library within my own Plugin and I inject that plugin during application initialization.
I'm using Zend ContextSwitch Helper to change the context of current view file with suffix 'mobile' like: index.mobile.phtml.
What I need to organize my existing views under separate folder for mobile like: /views/mobile/index.phtml not as /views/index.mobile.phtml (same folder).
//Add Context
$this->addContext('html', array('suffix' => 'mobile'));
Please advise me how can I tell application to search mobile views under mobile for every views.
I'm using Zend Framework 1.12 version
Your desired approach may be confusing because /views/mobile/index.phtml will refer to "mobile" controller
You may override this by simply changing the template path destination for mobile templates. $view->setScriptPath('mobile')
Another way is to store them in the same folder but with different suffix /views/controller-name/action-name.mobile.phtml
You can achieve this just by changing the view extension using view renderer. $viewRenderer->setViewSuffix('mobile.phtml');
Or you may rewrite your templates using responsive webdesign :-)
I wish to create a desktop and a mobile version of a site using HMVC in CodeIgniter.
This is similar to this question:
Mobile and desktop web app with codeigniter
but differs in that my views are stored in individual module directories which makes it difficult to change only the view path as suggested.
The Question:
How do I crate a mobile version of a site using the exact same controller logic as the desktop version, but with different views while using HMVC?
$this->load->library('user_agent');
if($this->agent->is_mobile())
{
//send to mobile theme
}
Even though wordpress uses PHP, I would like to build a web application within a wordpress site I already have, so that I don't have to redo the site from scratch, and can use the same design elements I've already developed.
Is there a way to have certain pages on my existing wordpress site run Grails in the background, and then spit out the appropriate HTML elements so that it can use the existing buttons, divs, etc.?
Grails and PHP it totatlly different techologies. Grails is a framework written in and uses Groovy/Java, requires different web-server, etc.
Btw, there is another way: you can hide this two apps behind one frontend (nginx, or something), and map (proxy) different urls to different apps, some urls to wordpress, some to grails app.
Another option to to use the Grails: Wordpress plugin.
This will allow your Grails site to host your existing Wordpress site.
I have to develop frontend/backend application using cakephp.
can you give me advice how should i develop them, using same cakephp library?
or I have to develop them using separate cakephp libraries?
I am confused - cakePHP would be used to implement both.
PHP would be used to implement the server-side backend. The same "project" would also contain HTML, JS, CSS, etc that will be used to render the front-end within the browser. Any PHP "views" will also execute code on the back-end, although any HTML output will be rendered on the frontend.
Does that help at all? Or am I missing something?
If by frontend/backend, you mean an application with a user interface (frontend) and an administration interface (backend), then you want to refer to the Prefix Routing section of the manual. This will allow you to have separate flow and interfaces (controller/view) for each type of user while sharing the same data (models).
If by frontend/backend, you mean an application (frontend) that communicates with another server application (backend) using web services, then you want to look at the Additional Class Paths section of the manual. This will allow you to share common classes with two (or more) separate applications.
Note: the above links are for CakePHP 3.x, though these features have existed in one form or another since v1.2.
Not quite sure if I understood you correct, but if I did:
You can set up multiple projects using the same cake-core files. The core files don't even need to be placed in the webroot folder..
http://book.cakephp.org/view/35/Advanced-Installation
For your own sanity, you should regard the backend management as part of the same project as the frontend.
The systems I have built generally use view-type methods for the public view and crud-type methods for the admin view. How you lock down the admin is your choice. Personally I don't like the default admin prefix way. I use login and ACL - Mark Story's tutorial on http://book.cakephp.org/ is superb. With that you can password protect methods.
CakePHP is very flexible and extensible and you can make the administration as simple or as flexible as you like.