Drupal, set dynamically css - css

Does anyone know how to set dynamical css in a Drupal 7 theme? Depending on the browser I want to choose one or another file.
Thanks a lot!

Take a look at the Browser class module, and the Browscap module. These projects will lead to a result that does what you want.
This small module helps theme-developers to deal with cross-browser compatibility. It makes easier to handle different types of non-widespread browsers just as much as it helps with using different versions of Internet Explorer.
The module extends the $body_classes variable in page.tpl.php based on the enduser's browser, and platform.
Browscap provides an improved version of PHP's get_browser() function.
The get_browser() function can be used to tell what a visitor's browser is capable of. Unfortunately, the version provided by PHP has a number of limitations, namely:
It can be difficult or impossible to configure for shared hosting environments.
The data used to identify browsers and determine their capabilities requires consistent maintenance to keep up-to-date.
Browscap automates maintenance by storing browser data in a database and automatically retrieving the latest data on a configurable schedule.

Related

Trusted Web Activity & Bubblewrap forcing the render engine (Chromium/firefox/geko)

Is there a way with bubblewrap when building a TWA to force the #custom-tabs engine that is used? Ie at the moment if a user has their default browser set as Firefox the TWA installed will use the Firefox/gecko implementation...
I'd rather force TWA to use chromium #custom-tabs due to additional APIs available and CSS handling..
Additionally testing is far easier with one engine than two.
Thanks
Bubblewrap doesn't provide an option to always use a specific provider. That is by design, for two reasons:
it's not possible to guarantee that a given browser will be installed for all users.
favour the user's browser choice.
It is possible to modify the app directly to get this behaviour, but due to the reasons above, not recommended.

What is the advantage in using CDN?

People often suggest CDNs for public library. The one I read today goes like this:
It's recommended that production applications utilize CDNs for common
libraries like AngularJS
https://learn.microsoft.com/en-us/aspnet/core/client-side/angular
Why it is recommended so?
One thing I can think of is, since the content comes from different domain, the browser specific limit for number of connections to a domain will not be a bottle-neck for loading scripts if multiple such libraries are being used. However, this can be solved by combining scripts.
Do you know any other benefits?
The answer you provided yourself is in-fact a good reason as to why you should use a CDN. Another reason which you overlooked and is dependent on how the CDN is structured is that, if the library gets updated, anyone using the CDN version will get the newest version with no hassle(obviously this wont work if you are referencing a file which has a version number directly i.e. jquery-1.3.2.js).

Architecture for Web-App development aimed at aiding interoperability between CMS systems. Has it been done?

I'm thinking about attempting to design a new framework architecture aimed at allowing a web app to later be easily ported into a system such as Drupal or Joomla while maintaining the independence of the original app such that updates to core functionality would require only one release or otherwise minimal extra work.
Before I start on this however, I would like to see what work has previously been done that comes closest to what I am proposing. So an answer to this question would come in the form of a reference to the most similar work or if possible a definitive 'no' that this has not been done before.
Clarification by example: MediaWiki is a common web app that has become one of the most highly recommended of its kind. However, site admins building their sites with Drupal would be required to hack MediaWiki in order for it to play nicely with Drupal in terms of sharing a user base for example. Imagine that MediaWiki has decided to do a complete rebuild of their system, what design could be used to make this interaction simply require a Drupal module or Joomla component and thus make MediaWiki available to more users?
I'm using MediaWiki as just an example, I think modules and components already exist that solve this particular problem but I hope I am able to get my idea across. It is a problem I have encountered many times during web development now that CMS systems are appearing more and more enterprise-like.
Thanks!
godwin
Content Management Interoperability Services (CMIS) is an OASIS Specification that you can use to imrprove the data portability and interoperability of a CMS. If your system has (or your provide) a CMIS interface, you can move content to / from other CMS systems that also provide CMIS interfaces.
See:
http://en.wikipedia.org/wiki/Content_Management_Interoperability_Services
http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=cmis

Working with version control on a Drupal/CMS project

I was wondering how teams that develop sites using Drupal (or any other CMS) integrate version control, subversion, git or similar, into their workflow. You'd obviously want your custom code and theme files under version control but when you use a CMS such as Drupal a lot of the work consists of configuring modules and settings all of which is stored in the database.
So when you are a team of developers, how do you collaborate on a project like this? Dumping the database into a file and putting that file under version control might work I guess, but when the site is live the client is constantly adding content which makes syncing a bit problematic.
I'd love to know how others are doing this.
You are correct that this is an issue for Drupal--version control works fine until you turn the site over to your client or open it up to users.
Your question seems like a more specific version of this one, which touched on version control in the Drupal workflow. You may find some answers there that help.
For some projects, I have exported all of the views to code, using that feature of the Views module, and I have one project where all of the blocks have been exported, as well. (Although that was a development exercise and not a customary thing to do with blocks.)
Take a look at the work that Development Seed is doing to work around this problem. They are leading the development of the Context, Features, and Spaces modules that work together to store configuration data in modules (outside of the DB) so that it can be versioned with the code.
There is a Drupal group called Packaging & Deployment for discussing the various solutions that are being developed for this issue.
Right now there are a lot of efforts towards creating something that will handle the dev -> production difficulties with drupal in relation to the database. Features, that flaminglogos mentioned is one, but I feel that is more focused on creating stand alone projects, ie ones that would be installed on many sites.
For simple maintaining you dev and prod databases I'd take a look at http://drupal.org/project/deploy and http://drupal.org/project/dbscripts. They support syncing and merging db side drupal config data.
I can't guarantee they are ready for prime time though...
There is a lot of effort of shipping the next drupal version with configuration in code. That's is the key to have it in a version system.
For now you can use the features module, with that you can export things like content types, views, etc. to code, and then compare, version and revert it as you need.

How to make two web sites appear as one - What features are important?

I am about to write a tender. The solution might be a PHP based CMS. Later I might want to integrate an ASP.NET framework and make it look like one site.
What features would make this relatively easy.
Would OpenId and similar make a difference?
In the PHP world Joomla is supposed to be more integrative than Druapal. What are the important differences here?
Are there spesific frameworks in ASP.NET, Python or Ruby that are more open to integration than others?
The most important thing is going to be putting as much of the look-and-feel in a format that can be shared by any platforms. That means you should develop a standard set of CSS files and (X)HTML files which can be imported (or directly presented) in any of those platform options. Think about it as writing a dynamic library that can be loaded by different programs.
Using OpenID for authentication, if all of your platform options support it, would be nice, but remember that each platform is going to require additional user metadata be stored for each user (preferences, last login, permissions/roles, etc) which you'll still have to wrangle between them. OpenID only solves the authentication problem, not the authorization or preferences problems.
Lastly, since there are so many options, I would stick to cross-platform solutions. That will leave you the most options going forward. There's no compelling advantage IMHO to using ASP.NET if there's a chance you may one day integrate with other systems or move to another system.
I think that most important thing is to choose the right server. The server needs to have adequate modules. Apache would be good choice as it supports all that you want, including mod_aspnet (which I didn't test, but many people say it works).
If you think asp.net integration is certanly going to come, I would choose Windows as OS as it will certanly be easier.
You could also install reverse proxy that would decide which server to render content based on request - if user request aspx page, proxy will connect to the IIS and windoze page, if it asks for php it can connect to other server. The problem with this approach is shared memory & state, which could be solved with carefull design to support this - like shared database holding all state information and model data....
OpenID doesn't make a difference - there are libs for any framework you choose.

Resources