Drupal, Silex, Symfony2, Ubuntu, Website Development
Sometimes when moving a Drupal directory it will not copy all the files into the new directory. This can be caused by the way you copy the files and/or the permissions of the files on the webserver. I had a Drupal site that would work perfectly in its original directory but if I copied the Drupal 7 software into another directory I would get a 500 error or the browser would go blank. It took me a while to find the .htaccess was not copying into the new directory. As soon as I manually copied it across the website worked perfectly.Read more
I need a small smtp client so I could send emails from my Drupal development machine. By using the package msmtp-mta this can be achieved. Firstly install the software, in this example Ubuntu will be used but from what I can see all Unix flavours have this package
~$ sudo apt-get install msmtp-mta
After it is installed then configuration is needed this can be by creating a file called msmtprc and adding some configuration.
After installing it we need to create a configuration file for it. Create a new file by opening vim or nano in the terminal
~$ sudo vim /etc/msmtprc
Then add the configuration you need to access your email smtp server. In this example we will use the Google smtp servers.Read more
Git is fantastic but there are times when you need to find that odd command because you have stuffed something up. Here are some I use on those occasions, firstly open the terminal and navigate to the root directory of the Git repo.
You didn't want to commit that
~$ git reset --soft HEAD~1
I want to remove the second last commit
~$ git rebase -i HEAD~2
The master branch commits have moved ahead from my-current-branch when I first branched off
~$ git checkout my-current-branch ~$ git rebase master
I need to see the changes before I commit
~$ git diff [filename]
I need to see a users commits in the logs
~$ git log --author="username"
I want see what was committedRead more
Merging two Git branches and then commiting each merge file seperaterly looks easy except while in a merge Git will not let you do it. This howto will explain one way how to do it. Firstly go to the terminal window and move to the Git directory that you want to merge. In this example I am going to merge the large-branch-to-be-merge into the master. Check out the master branch or the branch you want to merge like the example below.
~$ git checkout master ~$ git branch large-branch-to-be-merge *master
The next step is to do the merge so that your wonderful new set of code will make the amazing changes to the software.Read more
As a Drupal click monkey I came away from Drupalcon Sydney determined that I was going to contribute back to Drupal in some way. The big push in the community is to help with core development and the issue cues if you are able. But to a new Drupaler it is like looking at a mountain you need to climb and the only tool you have is a toothpick. I was listening to a Drupalise.me podcast that was discussing contributing back to the community, what I found interesting about the conversation was when they started to contribute it was like looking at a mountain to climb and only having a toothpick. I was not alone it seems.Read more
On a project early this year I found the need to add a view of images between the content type body and comments. I looked at context module as I have used it before. But on reflection the website was very small and I didn't see the need to install an extra module for this small job. After some research I found the function views_embed_views this allows the developer to add a view to a tpl file using code. This post shows you how you can do it for yourself. Firstly create a view that has a view page and view block and call the view anything you like. I have called mine views_embed_view (not very imagitive I know).Read more
jQuery is the framework of the future and its uptake across the internet is everywhere. Now the jQuery developers have created a mobile version for mobile devices. This tool saves developers time and the client money and the documentation for using it is widely available. Below is jQuery in its simplest forms, the examples below are what every developer uses when using this framework. Let's take some time to explain what it all means.Read more
Increase memory using php.ini file
Increasing your memory for the Drupal Framework is important as this allows the application to work faster and then deliver the content to the user giving faster access to the content that you are providing. There are two ways to do this, if you have access to your php.ini file on your web server find the line that says the following.
memory_limit = 16M ;
Most service providers will only allocate the default amount of 16 megabytes of ram. If you change it to 64 megabytes of ram this will fix the issue.Read more
If you are using Drush you know how powerful this Drupal command line tool can be. It will deploy and maintain a complete Drupal website in seconds. Below is a selection of commands that are useful for a web developer, feel free to take a copy for your own use. For the commands to work you have to ensure that Drush is installed on your computer to find out more go to drupal project drush if you are using Debian it will be in the repositories. The drush commands below are in the directory of the drupal install when being used.