Pages

Friday, February 28, 2014

Convert Your Site into a Firefox OS App

Open web apps are here thanks to Firefox OS, which makes it possible to build apps with only HTML, Javascript and CSS.
This is a great advantage for web developers who don't want to code for iOS or Android devices.
In this tutorial, we'll show you how to convert your existing responsive website into an app that can run on Firefox OS devices.

Step #1. HTML file

  • Create a file named index.html with the following code:
01.<!DOCTYPE html>
02.<html>
03.<head>
04.<meta charset="utf-8">
05.<title>OSTraining Blog</title>
06.<meta name="description" content="">
07.<meta name="viewport" content="width=device-width">   
08.<meta http-equiv="refresh" content="5;url=http://www.oktamam.in">   
09.</head>
10.<body>
11.<p>Loading...</p>
12.</body>
13.</html>
  • In the previous code, replace http://www.oktamam.in with your own URL
  • Replace 5 (seconds) with the loading time to display the message: "Loading..."

Step #2. Icon images

  • Create 3 .png images. These will need to be of different sizes for use on different devices. We're going to create icons that 16x16, 48x48 and 128x128.
  • Create a folder called /img/ and place the images inside.
website firefox os app

Step #3. Manifest file

  • Create a file called manifest.webapp and add the following code:
01.{
02."version""1.0.0",
03."name""OSTraining Blog",
04."description""Blog post and tutorial about web development",
05."launch_path""/index.html",
06."icons": {
07."16""/img/icon-16.png",
08."48""/img/icon-48.png",
09."128""/img/icon-128.png"
10.},
11."developer": {
12."name""Valentin Garcia",
13."url""http://www.oktamam.in"
14.}
15.}
  • Version: is the software control for the app
  • Name: the name of your app
  • Launch pat: should point this to your index.html file
  • Icons: you can set the icons path
  • Developer: your developer name and URL

Step #4. Create the install package

  • Create a zip file with your files inside:
website firefox os app

Step #5. Submit your app

  • The final step is send the zip file to Firefox Marketplace.
  • If you don't have an account, create one and login. Then go to Developers page >> Submit An App.
  • Once you complete the form and upload the zip file, you need to wait for the review and approval. This may take from hours to days.

The State of Drupal 8

Where is Drupal 8 Now?

As I write in November 2013, Drupal is at Alpha 6 which you can download from herehttps://drupal.org/node/2142291.
The Drupal team are releasing Alpha versions every month.
There are no upgrade paths betweeen Alpha versions so these can't be used for an actual site. The Alpha phase is for testing and development.
Please note that this post will only go over what's been added since our last "State of Drupal 8" update. Scroll to the bottom to see all previous blogs in this series.

New Installation Design

The Drupal 8 installation process is technically similar to Drupal 7, but there has been a slick re-design of the interface:
media_1384879363069.png

Multi-lingual improvements are Finished

The multi-lingual changes in Drupal 8 are now just about complete. All 4 core multi-lingual modules are now available.
media_1385558549334.png

More UI Changes

If you navigate the latest Drupal 8 alpha, you'll see that more work has gone into cleaning up and simplifying the interface.
There are very few major changes, but lots of small usability improvements. One of my favorites is the new block screen. If you're familiar with WordPress, this is similar to the Widgets screen, but in reverse.
All of the available blocks are on the right-hand side and can be placed into regions on the left-hand side.
media_1384879665903.png

Overlay and PHP Module Are Removed

Two of the most controversial modules in Drupal 7 have been removed.
  • Overlay placed all admin screens in pop-up box. This would often break and wasn't mobile-friendly. It's fair to say that most developers disabled this module.
  • PHP allows users to write PHP code directly into the Drupal admin area. This could be a very dangerous feature in the wrong hands.
media_1385560969619.png

New Release Cycle

The Drupal team have proposed a new release cycle. You can read the full details athttps://drupal.org/node/2135189.
If you're familiar with the Joomla, Typo3 or even Ubuntu release cycles, then this will be very similar. Here's a high-level overview of the new release cycle:
  • Drupal 7 would be called a Long Term Support (LTS) version and would keep getting fixes until Drupal 9.
  • Drupal 8 would be a called Short Term Support (STS) version and will get incremental versions with new features: 8.1, 8.2, 8.3 etc.
  • Drupal 8 would eventually get a final release that will become the new LTS.
  • Drupal 9 would only start serious development when there is a large completed feature that can justify the start.
  • Major versions will probably continue to release every few years.
media_1385559885319.png

The Release Date

We've been running this series for 2 years now and in that time we've had a few guesses as to when as stable Drupal 8 will arrive.
Back in late 2012, the estimate was a release in early 2014. Since then there have been some more ambitious guesses, but generally the consensus of early-to-mid 2014 has held.
However, lately I think ti's fair to say that the estimates have been getting pushed back and a date towards the end of 2014 is more likely. There are still major changes to come, including work on the Migrate module to make upgrading easier for those on previous Drupal versions.

http://drupalreleasedate.com/chart/samples is a good way to track how close Drupal 8 is getting to release. It shows you how many issues are left to be solved before a release is possible. At the moment, the chart clearly shows why people think that a release is getting further away, rather than closer:
media_1385559673908.png

Understanding The New Drupal Release Cycle

At the end of 2013, big changes were made to the Drupal release cycle.
You can read full details of the changes at https://drupal.org/node/2135189.
The changes will start with Drupal 8, but are going to impact almost all current and future versions.
In this blog post, I'll give you a short, plain-English overview of the changes.
I'll show how the changes will impact users of Drupal 6, 7, 8 and 9.

What is changing for Drupal 8?

  • Drupal 8 will have several releases with new features.
  • New Drupal 8 releases will come out every 6 months. They may have new features and will be called 8.1, 8.2, 8.3 etc.
  • The latest release will be the only one that's supported.
  • The end of the process will be a Long Term Support version or LTS. When that LTS arrives, no new features will be added, only security fixes.
Here's a graphical overview of how the releases will work:
media_1393365446214.png
Here's the big change: new features can now be added after the 8.0 release.
One of the downsides to Drupal's old release cycle is that new features couldn't be added.
Drupal 7 was essentially finished in 2010 (although it was released the next year). So no new features have been added to Drupal since 2010.
That feature freeze is great for enterprise customers, but very clunky for today's software developers who are used to working iteratively, making fast and regular updates.
In the proposal, Dries said that the new release cycle allows them to use "a more agile development approach of getting smaller changes out faster, seeing how they do, and making further changes based on real-world data. "
In the comments, Jesse Beach (who is responsible for much of the work on Drupal's UI) said, "Building a usable UI requires numerous iterations and we really don't get those over large major release cycles."

What does this mean for Drupal 9?

  • Drupal 9 will only start development when the the core team have completed a new feature big enough to justify a new version.
  • Drupal 9 should arrive on a normal schedule, which is 2 or 3 years after Drupal 8.

What does this mean for Drupal 6 and 7?

Wait, why are we bringing 6 and 7 into this?
Because this new release cycle may be good news for owners of Drupal 6 and 7 sites:
  • Drupal 6 would be security supported until 8's LTS rather than only until 8.0.
  • Drupal 7 would be security supported until 9's LTS rather than only until 9.0.
So this change could mean an extra 18 months of fixes. It's possible that this could mean Drupal 7 support until 2018 or 2019.

What does this mean for you building sites in the future?

Be very careful with the selection and quantity of modules you use in Drupal 8. This is good practice anyway, but will become a more formal recommendation with Drupal 8.
Here's the advice from the release cycle proposal:
"Don't use custom modules; stick to only contrib modules that are adequately maintained. Or, if your site requires custom code, make sure the developers you hire know to limit their code to only accessing APIs marked as stable."
In other words, changes may happen between Drupal 8.0 and the Drupal 8 LTS. If you build you own modules or use poorly supported custom modules, watch carefully in case updates cause problems.

Wait, doesn't this all sounds very familiar?

Yes, this release cycle is very similar to those adopted by Joomla and Typo3 amongst others.
This release cycle is one form of Semantic Versioning which is adopted by many products: http://semver.org.

Saturday, February 22, 2014

Show Drupal Users Their Own Content

If you have multiple content creators on your site, you may want to make their life easier.
One way that you can help is by providing a list of the content they have created.
There are advanced ways to do this, such as using the Workbench module, but in this tutorial we'll show you an easy way to provide a list of each user's content.
The only module that you need to do this is Views:http://drupal.org/project/views.
  • Get started by going to Structure > Views.
  • Click Add new view.
  • Enter a View name.
  • Choose to create a block.
media_1386106465094.png
  • Click Continue & edit.
  • Find the Relationships area on the right-hand side and click Add.
media_1386106565625.png
  • Search for and choose Content: Author
media_1386106599828.png
  • Click Apply (all displays) twice.
  • Find the Filter Criteria area on the left-hand side and click Add.
media_1386106701331.png
  • Choose User: Current.
[Note] In Views 2, this option was available without adding the relationship first. Now, you must make sure the relationship is added.
media_1386106784320.png
  • Click Apply (all displays).
  • Set Is the logged in user to Yes:
media_1386106839544.png
  • Click Apply (all displays).
  • Click Save in the top-right corner.
If you want to test that you've set up your block correct, try this test:
  • Click Add next to Fields.
  • Search for and choose User: Name.
  • Click Apply (all displays).
You'll now be able to see the preview below. You can make sure that each content comes from the same author.
media_1386106993040.png
If this is correct, you can click Cancel to discard your changes.
You can now go and publish your block via Structure > Blocks.