More excerpts
This commit is contained in:
parent
262b5dca2f
commit
867d8efef2
|
@ -8,6 +8,13 @@ tags:
|
||||||
- drupal-planet
|
- drupal-planet
|
||||||
- drupal
|
- drupal
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
Today, I had a situation where I was displaying a list of teasers for news article nodes. The article content type had several different fields assigned to it, including main and thumbnail images. In this case, I wanted to have different output and fields displayed when a teaser was displayed compared to when a complete node was displayed.
|
||||||
|
|
||||||
|
I have previously seen it done this way by adding this into in a node.tpl.php file:
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Today, I had a situation where I was displaying a list of teasers for news article nodes. The article content type had several different fields assigned to it, including main and thumbnail images. In this case, I wanted to have different output and fields displayed when a teaser was displayed compared to when a complete node was displayed.
|
Today, I had a situation where I was displaying a list of teasers for news article nodes. The article content type had several different fields assigned to it, including main and thumbnail images. In this case, I wanted to have different output and fields displayed when a teaser was displayed compared to when a complete node was displayed.
|
||||||
|
|
||||||
I have previously seen it done this way by adding this into in a node.tpl.php file:
|
I have previously seen it done this way by adding this into in a node.tpl.php file:
|
||||||
|
@ -63,3 +70,4 @@ array (
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
Now, within my theme I can create a new node--article-teaser.tpl.php template file and this will get called instead of the node--article.tpl.php when a teaser is loaded. As I'm not specifying the node type specifically and using the dynamic <em>$node->type</em> value within my suggestion, this will also apply for all other content types on my site and not just news articles.
|
Now, within my theme I can create a new node--article-teaser.tpl.php template file and this will get called instead of the node--article.tpl.php when a teaser is loaded. As I'm not specifying the node type specifically and using the dynamic <em>$node->type</em> value within my suggestion, this will also apply for all other content types on my site and not just news articles.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -7,7 +7,16 @@ tags:
|
||||||
- code
|
- code
|
||||||
- drupal
|
- drupal
|
||||||
---
|
---
|
||||||
When you download [Drupal](http://drupal.org), there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications. Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration:
|
{% block excerpt %}
|
||||||
|
When you download [Drupal](http://drupal.org/project/drupal), there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications.
|
||||||
|
|
||||||
|
Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
When you download [Drupal](http://drupal.org/project/drupal), there are several text files that are placed in the root of your installation. You don't want or need these to be visible to anyone attempting to view them in a browser - especially CHANGELOG.txt as that includes the exact version of Drupal you are running and could therefore have security implications.
|
||||||
|
|
||||||
|
Rather than delete these files or change the file permissions manually for each file, I can add the following lines into my VirtualHost configuration:
|
||||||
|
|
||||||
<Files ~ "\.txt$">
|
<Files ~ "\.txt$">
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
|
@ -15,3 +24,4 @@ When you download [Drupal](http://drupal.org), there are several text files that
|
||||||
</Files>
|
</Files>
|
||||||
|
|
||||||
This prevents any files with a .txt extension from being accessed and rendered in a web browser.
|
This prevents any files with a .txt extension from being accessed and rendered in a web browser.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -6,6 +6,11 @@ tags:
|
||||||
- svn
|
- svn
|
||||||
- version-control
|
- version-control
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
How to checkout a specific revision from a SVN (Subversion) repository.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
If you're checking out the repository for the first time:
|
If you're checking out the repository for the first time:
|
||||||
|
|
||||||
svn checkout -r 1234 url://repository/path
|
svn checkout -r 1234 url://repository/path
|
||||||
|
@ -13,3 +18,4 @@ If you're checking out the repository for the first time:
|
||||||
If you already have the repository checked out:
|
If you already have the repository checked out:
|
||||||
|
|
||||||
svn up -r 1234
|
svn up -r 1234
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -11,6 +11,11 @@ tags:
|
||||||
- drupal-planet
|
- drupal-planet
|
||||||
- drupal
|
- drupal
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
How to use a date popup calendar within your custom module.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
First, I need to download the [Date](http://drupal.org/project/date "Date module on Drupal.org") module, and make my module dependent on date_popup by adding the following line into my module's .info file.
|
First, I need to download the [Date](http://drupal.org/project/date "Date module on Drupal.org") module, and make my module dependent on date_popup by adding the following line into my module's .info file.
|
||||||
|
|
||||||
dependencies[] = date_popup
|
dependencies[] = date_popup
|
||||||
|
@ -34,3 +39,4 @@ $form['date'] = array(
|
||||||
'#default_value' => date('Y-m-d', time()),
|
'#default_value' => date('Y-m-d', time()),
|
||||||
);
|
);
|
||||||
~~~
|
~~~
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -9,6 +9,11 @@ tags:
|
||||||
- apache
|
- apache
|
||||||
- mod_rewrite
|
- mod_rewrite
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
How to use the .htaccess file to forward to a different domain.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Within the mod_rewrite section of your .htaccess file, add the following lines:
|
Within the mod_rewrite section of your .htaccess file, add the following lines:
|
||||||
|
|
||||||
RewriteCond %{HTTP_HOST} ^yoursite\.co\.uk$
|
RewriteCond %{HTTP_HOST} ^yoursite\.co\.uk$
|
||||||
|
@ -23,3 +28,4 @@ This automatically forwards any users from http://yoursite.co.uk to http://yours
|
||||||
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
|
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
|
||||||
|
|
||||||
If any of the RewriteCond conditions apply, then the RewriteRule is executed.
|
If any of the RewriteCond conditions apply, then the RewriteRule is executed.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -8,6 +8,11 @@ tags:
|
||||||
- drupal
|
- drupal
|
||||||
- code
|
- code
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
An example .info file for a Drupal 7 theme.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
~~~
|
~~~
|
||||||
name = My Theme
|
name = My Theme
|
||||||
description = A description of my theme
|
description = A description of my theme
|
||||||
|
@ -37,3 +42,4 @@ stylesheets[print][] = css/print.css
|
||||||
# Add javascript files
|
# Add javascript files
|
||||||
styles[] = js/mytheme.js
|
styles[] = js/mytheme.js
|
||||||
~~~
|
~~~
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -9,6 +9,13 @@ tags:
|
||||||
- theming
|
- theming
|
||||||
- preprocessing
|
- preprocessing
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code.
|
||||||
|
|
||||||
|
Following the example of the [Omega theme](http://drupal.org/project/omega "The Omega theme on Drupal.org"), I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code. Following the example of the [Omega theme](http://drupal.org/project/omega "The Omega theme on Drupal.org"), I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
|
If you use a lot of process and preprocess functions within your Drupal theme, then your template.php can get very long and it can become difficult to find a certain piece of code. Following the example of the [Omega theme](http://drupal.org/project/omega "The Omega theme on Drupal.org"), I've started separating my process and preprocess functions into their own files. For example, mytheme_preprocess_node can be placed within a preprocess/node.inc file, and mytheme_process_page can be placed within process/page.inc.
|
||||||
|
|
||||||
The first step is to use the default mytheme_process() and mytheme_preprocess() functions to utilise my custom function. So within my template.php file:
|
The first step is to use the default mytheme_process() and mytheme_preprocess() functions to utilise my custom function. So within my template.php file:
|
||||||
|
@ -81,3 +88,4 @@ function mytheme_invoke($type, $hook, &$variables) {
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
As `mytheme_invoke()` checks to see if the function already exists before searching for checking the include files, I could still add the functions into template.php as normal and this would override any corresponding include file.
|
As `mytheme_invoke()` checks to see if the function already exists before searching for checking the include files, I could still add the functions into template.php as normal and this would override any corresponding include file.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -10,9 +10,15 @@ tags:
|
||||||
- drupal-planet
|
- drupal-planet
|
||||||
- accessibility
|
- accessibility
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
After a busy few days, I've released two new contrib Drupal modules.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
After a busy few days, I've released two new contrib Drupal modules:
|
After a busy few days, I've released two new contrib Drupal modules:
|
||||||
|
|
||||||
* [Block Aria Landmark Roles](http://drupal.org/project/block_aria_landmark_roles) - Inspired by [Block Class](http://drupal.org/project/block_class), this module adds additional elements to the block configuration forms that allow users to assign a ARIA landmark role to a block.
|
* [Block Aria Landmark Roles](http://drupal.org/project/block_aria_landmark_roles) - Inspired by [Block Class](http://drupal.org/project/block_class), this module adds additional elements to the block configuration forms that allow users to assign a ARIA landmark role to a block.
|
||||||
* [Nomensa Accessible Media Player](http://drupal.org/project/nomensa_amp) - Provides integration with Nomensa's [Accessible Media Player](https://github.com/nomensa/Accessible-Media-Player).
|
* [Nomensa Accessible Media Player](http://drupal.org/project/nomensa_amp) - Provides integration with Nomensa's [Accessible Media Player](https://github.com/nomensa/Accessible-Media-Player).
|
||||||
|
|
||||||
Documentation for both to follow shortly on Drupal.org.
|
Documentation for both to follow shortly on Drupal.org.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -8,6 +8,11 @@ tags:
|
||||||
- drupal-planet
|
- drupal-planet
|
||||||
- nomensa
|
- nomensa
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
*The official documentation for this module is now located at <https://www.drupal.org/node/2383447>. This post was accurate at the time of writing, whereas the documentation page will be kept up to date with any future changes.*
|
*The official documentation for this module is now located at <https://www.drupal.org/node/2383447>. This post was accurate at the time of writing, whereas the documentation page will be kept up to date with any future changes.*
|
||||||
|
|
||||||
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
|
This week I released the first version of the Nomensa Accessible Media Player module for Drupal 7. Here's some instructions of how to install and configure it.
|
||||||
|
@ -57,3 +62,4 @@ For example:
|
||||||
## Screencast
|
## Screencast
|
||||||
|
|
||||||
<a class="player" href="http://vimeo.com/45731954">Nomensa Accessible Media Player for Drupal</a>
|
<a class="player" href="http://vimeo.com/45731954">Nomensa Accessible Media Player for Drupal</a>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -10,6 +10,12 @@ tags:
|
||||||
- writing
|
- writing
|
||||||
- linux-journal
|
- linux-journal
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
I'm absolutely delighted to announce that I'm going to be writing an article for [Linux Journal](http://www.linuxjournal.com) magazine's upcoming Drupal special.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
I'm absolutely delighted to announce that I'm going to be writing an article for [Linux Journal](http://www.linuxjournal.com) magazine's upcoming Drupal special. The article is going to be entitled "Speeding Up Your Drupal Development Using Installation Profiles and Distributions" and will be mentioning existing distributions available on Drupal.org, but mainly focussing on the steps needed to create your own custom distribution. Needless to say, I'm quite excited about it!
|
I'm absolutely delighted to announce that I'm going to be writing an article for [Linux Journal](http://www.linuxjournal.com) magazine's upcoming Drupal special. The article is going to be entitled "Speeding Up Your Drupal Development Using Installation Profiles and Distributions" and will be mentioning existing distributions available on Drupal.org, but mainly focussing on the steps needed to create your own custom distribution. Needless to say, I'm quite excited about it!
|
||||||
|
|
||||||
The article is expected to be published in October.
|
The article is expected to be published in October.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -10,6 +10,11 @@ tags:
|
||||||
- php
|
- php
|
||||||
- aria
|
- aria
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
For reference, this is the code needed to display a menu in a Drupal 7 template file, including the navigation ARIA role.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
For reference, this is the code needed to display a menu in a Drupal 7 template file, including the navigation ARIA role.
|
For reference, this is the code needed to display a menu in a Drupal 7 template file, including the navigation ARIA role.
|
||||||
|
|
||||||
~~~php
|
~~~php
|
||||||
|
@ -24,3 +29,4 @@ print theme('links', array(
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
~~~
|
~~~
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -6,6 +6,11 @@ slug: reflections-speaking-unifieddiff
|
||||||
tags:
|
tags:
|
||||||
- talks
|
- talks
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
Yesterday evening I went along and spoke at the [UnifiedDiff meetup](http://www.unifieddiff.co.uk) in Cardiff, having offered previously to do a presentation providing an introduction to Drupal.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Yesterday evening I went along and spoke at the [UnifiedDiff meetup](http://www.unifieddiff.co.uk) in Cardiff, having offered previously to do a presentation providing an introduction to Drupal.
|
Yesterday evening I went along and spoke at the [UnifiedDiff meetup](http://www.unifieddiff.co.uk) in Cardiff, having offered previously to do a presentation providing an introduction to Drupal.
|
||||||
|
|
||||||
I'm an experienced Drupal Developer, but not an experienced public speaker (although I have done several user training sessions and Drupal demonstrations for clients previously), and I think that some of the nerves that I had beforehand were apparent during the presentation, and being the first speaker for the evening probably didn't help, although I did get a [nice tweet](https://twitter.com/craigmarvelley/status/243418608720543745) mid-way through.
|
I'm an experienced Drupal Developer, but not an experienced public speaker (although I have done several user training sessions and Drupal demonstrations for clients previously), and I think that some of the nerves that I had beforehand were apparent during the presentation, and being the first speaker for the evening probably didn't help, although I did get a [nice tweet](https://twitter.com/craigmarvelley/status/243418608720543745) mid-way through.
|
||||||
|
@ -13,3 +18,4 @@ I'm an experienced Drupal Developer, but not an experienced public speaker (alth
|
||||||
Initially, after aiming for a 20-minute presentation plus Q&A, I think I wrapped up the presentation in around 14 minutes, although I did about 6 minutes of answering questions afterwards including the apparently mandatory "Why use Drupal compared to WordPress or Joomla?" question, some Drupal 8 and Symfony questions, as well as an interesting question about the White House development project after I'd listed it within a list of example sites. Next time, I think that some more detailed presenter notes are needed. Typically, as soon as it sat back in my seat, the majority of things that I'd managed to remember beforehand all came flooding back to me and I thought "I should have said that whilst I was up speaking".
|
Initially, after aiming for a 20-minute presentation plus Q&A, I think I wrapped up the presentation in around 14 minutes, although I did about 6 minutes of answering questions afterwards including the apparently mandatory "Why use Drupal compared to WordPress or Joomla?" question, some Drupal 8 and Symfony questions, as well as an interesting question about the White House development project after I'd listed it within a list of example sites. Next time, I think that some more detailed presenter notes are needed. Typically, as soon as it sat back in my seat, the majority of things that I'd managed to remember beforehand all came flooding back to me and I thought "I should have said that whilst I was up speaking".
|
||||||
|
|
||||||
Overall, considering my inexperience at speaking to this type of audience, I was fairly happy with my presentation, although I'm sure that I'll change my mind once I've watched the video of it on the UnifiedDiff website. Regardless, I think that it was a great experience and I enjoyed doing it, and I'd like to thank the organisers of UnifiedDiff for having me speak at their meetup. It was great to have a more relaxed conversation with some people after the other speakers had been up, and having introduced Drupal I would be more than happy to come back and do a more in-depth presentation if there is an interest for me to do so.
|
Overall, considering my inexperience at speaking to this type of audience, I was fairly happy with my presentation, although I'm sure that I'll change my mind once I've watched the video of it on the UnifiedDiff website. Regardless, I think that it was a great experience and I enjoyed doing it, and I'd like to thank the organisers of UnifiedDiff for having me speak at their meetup. It was great to have a more relaxed conversation with some people after the other speakers had been up, and having introduced Drupal I would be more than happy to come back and do a more in-depth presentation if there is an interest for me to do so.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -5,6 +5,13 @@ description: <a href="http://www.sublimetext.com/2" title="Sublime Text 2">Subli
|
||||||
tags:
|
tags:
|
||||||
- sublime-text
|
- sublime-text
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
[Sublime Text 2](http://www.sublimetext.com/2) has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference.
|
||||||
|
|
||||||
|
These preferences ensure that the code is compliant with [Drupal coding standards](http://drupal.org/coding-standards "Drupal coding standards on Drupal.org") - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
[Sublime Text 2](http://www.sublimetext.com/2) has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference. These preferences ensure that the code is compliant with [Drupal coding standards](http://drupal.org/coding-standards "Drupal coding standards on Drupal.org") - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
|
[Sublime Text 2](http://www.sublimetext.com/2) has been my text editor of choice for the past few months, and I use it at home, in work, and on any virtual machines that I run. So rather than having to manually re-enter my settings each time, I thought that I'd document them here for future reference. These preferences ensure that the code is compliant with [Drupal coding standards](http://drupal.org/coding-standards "Drupal coding standards on Drupal.org") - using two spaces instead of a tab, no trailing whitespace, blank line at the end of a file etc.
|
||||||
|
|
||||||
## Preferences
|
## Preferences
|
||||||
|
@ -95,3 +102,4 @@ These are the packages that I currently have installed.
|
||||||
* [Package Control](http://wbond.net/sublime_packages/package_control)
|
* [Package Control](http://wbond.net/sublime_packages/package_control)
|
||||||
* [Sublime CodeIntel](http://github.com/Kronuz/SublimeCodeIntel)
|
* [Sublime CodeIntel](http://github.com/Kronuz/SublimeCodeIntel)
|
||||||
* [Theme - Soda](https://github.com/buymeasoda/soda-theme)
|
* [Theme - Soda](https://github.com/buymeasoda/soda-theme)
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -7,6 +7,14 @@ tags:
|
||||||
- accessible-bristol
|
- accessible-bristol
|
||||||
- nomensa
|
- nomensa
|
||||||
---
|
---
|
||||||
I'm happy to report that the [Accessible Bristol](http://www.accessiblebristol.org.uk) website was launched this week, on Drupal 7. The site's been developed over the past few months, and uses the [User Relationships](http://drupal.org/project/user_relationships) and [Privatemsg](http://drupal.org/project/privatemsg) modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
|
{% block excerpt %}
|
||||||
|
I'm happy to announce that the [Accessible Bristol](http://www.accessiblebristol.org.uk) website was launched this week, on Drupal 7.
|
||||||
|
|
||||||
|
The site has been developed over the past few months, and uses the [User Relationships](http://drupal.org/project/user_relationships) and [Privatemsg](http://drupal.org/project/privatemsg) modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
I'm happy to announce that the [Accessible Bristol](http://www.accessiblebristol.org.uk) website was launched this week, on Drupal 7. The site has been developed over the past few months, and uses the [User Relationships](http://drupal.org/project/user_relationships) and [Privatemsg](http://drupal.org/project/privatemsg) modules to provide a community-based platform where people with an interest in accessibility can register and network with each other.
|
||||||
|
|
||||||
The group is hosting a launch event on the 28th November at the Council House, College Green, Bristol. Interested? More information is available at <http://www.accessiblebristol.org.uk/events/accessible-bristol-launch> or go to <http://buytickets.at/accessiblebristol/6434> to register.
|
The group is hosting a launch event on the 28th November at the Council House, College Green, Bristol. Interested? More information is available at <http://www.accessiblebristol.org.uk/events/accessible-bristol-launch> or go to <http://buytickets.at/accessiblebristol/6434> to register.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -7,6 +7,11 @@ tags:
|
||||||
- mac-os-x
|
- mac-os-x
|
||||||
- terminal
|
- terminal
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
How to open Sublime Text from the command line.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Paste the following code into the Mac OS X Terminal, assuming that you've installed Sublime Text 2 into the /Applications folder.
|
Paste the following code into the Mac OS X Terminal, assuming that you've installed Sublime Text 2 into the /Applications folder.
|
||||||
|
|
||||||
$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/sublime
|
$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/sublime
|
||||||
|
@ -14,3 +19,4 @@ Paste the following code into the Mac OS X Terminal, assuming that you've instal
|
||||||
Now you can type `sublime <filename>` open a file or directory in Sublime Text, or `sublime .` to open the current directory.
|
Now you can type `sublime <filename>` open a file or directory in Sublime Text, or `sublime .` to open the current directory.
|
||||||
|
|
||||||
You can also type `sublime --help` to see a list of the available commands.
|
You can also type `sublime --help` to see a list of the available commands.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -12,6 +12,11 @@ tags:
|
||||||
- preprocessing
|
- preprocessing
|
||||||
- sass
|
- sass
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
I've recently started using [SASS](http://sass-lang.com) rather than LESS to do my CSS preprocessing - namely due to its integration with [Compass](http://compass-style.org) and it's built-in CSS3 mixins. Here are three modules that provide the ability to use SASS within Drupal.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
I've recently started using [SASS](http://sass-lang.com) rather than LESS to do my CSS preprocessing - namely due to its integration with [Compass](http://compass-style.org) and it's built-in CSS3 mixins. There are three modules that provide the ability to use SASS within Drupal:
|
I've recently started using [SASS](http://sass-lang.com) rather than LESS to do my CSS preprocessing - namely due to its integration with [Compass](http://compass-style.org) and it's built-in CSS3 mixins. There are three modules that provide the ability to use SASS within Drupal:
|
||||||
|
|
||||||
* [Sassy](http://drupal.org/project/sassy "Sassy module on drupal.org")
|
* [Sassy](http://drupal.org/project/sassy "Sassy module on drupal.org")
|
||||||
|
@ -56,3 +61,4 @@ Personally, in development, I'd set caching to 'uncached' and the error reportin
|
||||||
## Adding SASS files into your theme
|
## Adding SASS files into your theme
|
||||||
|
|
||||||
With this done, you can now add SASS and SCSS files by adding a line like `stylesheets[all][] = css/base.scss` in your theme's .info file.
|
With this done, you can now add SASS and SCSS files by adding a line like `stylesheets[all][] = css/base.scss` in your theme's .info file.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -10,6 +10,11 @@ tags:
|
||||||
- drupal-planet
|
- drupal-planet
|
||||||
- php
|
- php
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous).
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous):
|
I see this regularly when working on Drupal sites when someone wants to check whether the current user is logged in to Drupal (authenticated) or not (anonymous):
|
||||||
|
|
||||||
~~~~
|
~~~~
|
||||||
|
@ -56,3 +61,4 @@ function mymodule_menu() {
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
There is also a [user_is_anonymous()](http://api.drupal.org/api/drupal/modules!user!user.module/function/user_is_anonymous/7) function if you want the opposite result. Both of these functions are available in Drupal 6 and higher.
|
There is also a [user_is_anonymous()](http://api.drupal.org/api/drupal/modules!user!user.module/function/user_is_anonymous/7) function if you want the opposite result. Both of these functions are available in Drupal 6 and higher.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -8,6 +8,11 @@ tags:
|
||||||
- drupal-7
|
- drupal-7
|
||||||
- tokens
|
- tokens
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
This post outlines the steps required to create your own custom tokens in Drupal.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
This post outlines the steps required to create your own custom tokens in Drupal.
|
This post outlines the steps required to create your own custom tokens in Drupal.
|
||||||
|
|
||||||
When writing the recent releases of the [Copyright Block](http://drupal.org/project/copyright_block) module, I used tokens to allow the user to edit and customise their copyright message and place the copyright_message:dates token in the desired position. When the block is rendered, the token is replaced by the necessary dates.
|
When writing the recent releases of the [Copyright Block](http://drupal.org/project/copyright_block) module, I used tokens to allow the user to edit and customise their copyright message and place the copyright_message:dates token in the desired position. When the block is rendered, the token is replaced by the necessary dates.
|
||||||
|
@ -136,3 +141,4 @@ $b = token_replace($a);
|
||||||
// This would only use foo tokens.
|
// This would only use foo tokens.
|
||||||
$c = token_replace($a, array('foo'));
|
$c = token_replace($a, array('foo'));
|
||||||
~~~
|
~~~
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -7,6 +7,11 @@ tags:
|
||||||
- sublime-text
|
- sublime-text
|
||||||
- ubuntu
|
- ubuntu
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
After reading numerous blog posts about how to install [Sublime Text 2](http://www.sublimetext.com/2 "Sublime Text 2") in [Ubuntu](http://www.ubuntu.com/2 "Ubuntu"), this is definitely the quickest way!
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
After reading numerous blog posts about how to install [Sublime Text 2](http://www.sublimetext.com/2 "Sublime Text 2") in [Ubuntu](http://www.ubuntu.com/2 "Ubuntu"), this is definitely the quickest way! Just paste the following lines into your Terminal:
|
After reading numerous blog posts about how to install [Sublime Text 2](http://www.sublimetext.com/2 "Sublime Text 2") in [Ubuntu](http://www.ubuntu.com/2 "Ubuntu"), this is definitely the quickest way! Just paste the following lines into your Terminal:
|
||||||
|
|
||||||
$ sudo add-apt-repository ppa:webupd8team/sublime-text-2
|
$ sudo add-apt-repository ppa:webupd8team/sublime-text-2
|
||||||
|
@ -14,3 +19,4 @@ After reading numerous blog posts about how to install [Sublime Text 2](http://w
|
||||||
$ sudo apt-get install sublime-text
|
$ sudo apt-get install sublime-text
|
||||||
|
|
||||||
After running this, Sublime Text 2 has been installed within the */usr/lib/sublime-text-2* directory and can be launched from the Dashboard, or by typing `subl`, `sublime-text` or `sublime-text-2` into a Terminal window.
|
After running this, Sublime Text 2 has been installed within the */usr/lib/sublime-text-2* directory and can be launched from the Dashboard, or by typing `subl`, `sublime-text` or `sublime-text-2` into a Terminal window.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -7,8 +7,14 @@ tags:
|
||||||
- precedent
|
- precedent
|
||||||
- personal
|
- personal
|
||||||
---
|
---
|
||||||
Yesterday was my last day working at [Nomensa](http://www.nomensa.com "Nomensa"). Next week, I'll be starting as a Senior Developer at [Precedent](http://www.precedent.co.uk "Precedent").
|
{% block excerpt %}
|
||||||
|
Yesterday was my last day working at [Nomensa](http://www.nomensa.com "Nomensa"). Next week, I'll be starting as a Senior Developer at [Precedent](http://www.precedent.co.uk "Precedent").
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
Yesterday was my last day working at [Nomensa](http://www.nomensa.com "Nomensa"). Next week, I'll be starting as a Senior Developer at [Precedent](http://www.precedent.co.uk "Precedent").
|
||||||
|
|
||||||
The last 14 months that I've been working at Nomensa have been absolutely fantastic, and had allowed me to work on some great projects for great clients - mainly [unionlearn](http://www.unionlearn.org "unionlearn") and [Digital Theatre Plus](http://www.digitaltheatreplus.com "Digital Theatre Plus"). I've learned so much about accessibility and web standards, and have pretty much changed my whole approach to front-end development to accommodate best practices. I've also been involved with the Drupal Accessibility group since starting at Nomensa, and have written several accessibility-focused Drupal modules, including the [Nomensa Accessible Media Player](http://drupal.org/project/nomensa_amp "The Nomensa Accessible Media Player Drupal module") module and the [Accessibility Checklist](http://drupal.org/project/a11y_checklist "The accessibility checklist for Drupal"). I'll definitely be continuing my interest in accessibility, championing best practices, and incorporating it into my future work wherever possible.
|
The last 14 months that I've been working at Nomensa have been absolutely fantastic, and had allowed me to work on some great projects for great clients - mainly [unionlearn](http://www.unionlearn.org "unionlearn") and [Digital Theatre Plus](http://www.digitaltheatreplus.com "Digital Theatre Plus"). I've learned so much about accessibility and web standards, and have pretty much changed my whole approach to front-end development to accommodate best practices. I've also been involved with the Drupal Accessibility group since starting at Nomensa, and have written several accessibility-focused Drupal modules, including the [Nomensa Accessible Media Player](http://drupal.org/project/nomensa_amp "The Nomensa Accessible Media Player Drupal module") module and the [Accessibility Checklist](http://drupal.org/project/a11y_checklist "The accessibility checklist for Drupal"). I'll definitely be continuing my interest in accessibility, championing best practices, and incorporating it into my future work wherever possible.
|
||||||
|
|
||||||
With that all said, I'm really looking forward to starting my new role at Precedent, tackling some new challenges, and I'm sure that it'll be as great a place to work as Nomensa was.
|
With that all said, I'm really looking forward to starting my new role at Precedent, tackling some new challenges, and I'm sure that it'll be as great a place to work as Nomensa was.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -9,6 +9,11 @@ tags:
|
||||||
- git
|
- git
|
||||||
- terminal
|
- terminal
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
Whilst watching [Drupalize.me](http://drupalize.me "Drupalize.me")'s recent [Introduction to Git series](http://drupalize.me/series/introduction-git-series "Introduction to Git on Drupalize.me"), I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt. Here's how to do it.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Whilst watching [Drupalize.me](http://drupalize.me "Drupalize.me")'s recent [Introduction to Git series](http://drupalize.me/series/introduction-git-series "Introduction to Git on Drupalize.me"), I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt.
|
Whilst watching [Drupalize.me](http://drupalize.me "Drupalize.me")'s recent [Introduction to Git series](http://drupalize.me/series/introduction-git-series "Introduction to Git on Drupalize.me"), I thought it was useful the way that the current Git branch or tag name was displayed in the bash prompt.
|
||||||
|
|
||||||
For example (with some slight modifications):
|
For example (with some slight modifications):
|
||||||
|
@ -56,3 +61,4 @@ PS1="\u@\h:\w\$(parse_git_branch_or_tag) $ "
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
Restart your Terminal or type `source ~/.bashrc` to see your changes.
|
Restart your Terminal or type `source ~/.bashrc` to see your changes.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -9,6 +9,11 @@ tags:
|
||||||
- drupal-planet
|
- drupal-planet
|
||||||
- drupal
|
- drupal
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
Here are some useful links that I've found when researching about unit testing in Drupal using SimpleTest.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Here are some useful links that I've found when researching about unit testing in Drupal using SimpleTest:
|
Here are some useful links that I've found when researching about unit testing in Drupal using SimpleTest:
|
||||||
|
|
||||||
* [An Introduction to Unit Testing in Drupal](http://www.lullabot.com/blog/articles/introduction-unit-testing-drupal "An Introduction to Unit Testing in Drupal")
|
* [An Introduction to Unit Testing in Drupal](http://www.lullabot.com/blog/articles/introduction-unit-testing-drupal "An Introduction to Unit Testing in Drupal")
|
||||||
|
@ -17,3 +22,4 @@ Here are some useful links that I've found when researching about unit testing i
|
||||||
* [SimpleTest Tutorial (Drupal 7)](https://drupal.org/simpletest-tutorial-drupal7 "SimpleTest Tutorial (Drupal 7)")
|
* [SimpleTest Tutorial (Drupal 7)](https://drupal.org/simpletest-tutorial-drupal7 "SimpleTest Tutorial (Drupal 7)")
|
||||||
* [SimpleTest Reference](https://drupal.org/node/278126 "SimpleTest Reference")
|
* [SimpleTest Reference](https://drupal.org/node/278126 "SimpleTest Reference")
|
||||||
* [Testing with SimpleTest](https://drupal.org/node/1128366 "Testing with SimpleTest")
|
* [Testing with SimpleTest](https://drupal.org/node/1128366 "Testing with SimpleTest")
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -9,6 +9,13 @@ tags:
|
||||||
- domain
|
- domain
|
||||||
- table-prefixing
|
- table-prefixing
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
The [Domain Access project](https://drupal.org/project/domain "The Domain Access project on Drupal.org") is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
|
||||||
|
|
||||||
|
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment.
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
The [Domain Access project](https://drupal.org/project/domain "The Domain Access project on Drupal.org") is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
|
The [Domain Access project](https://drupal.org/project/domain "The Domain Access project on Drupal.org") is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The issue is that the domains are stored within the database so these are copied across when the data is migrated between environments, whereas the domains are obviously going to change.
|
||||||
|
|
||||||
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment. With a live, staging and local domains, the tables would be named as follows:
|
Rather than changing the domain settings within the Domain module itself, the best solution I think is to use table prefixes and create a different domain table per environment. With a live, staging and local domains, the tables would be named as follows:
|
||||||
|
@ -39,3 +46,4 @@ $databases['default']['default'] = array(
|
||||||
Within each environment-specific domain table, update the subdomain column to contain the appropriate domain names.
|
Within each environment-specific domain table, update the subdomain column to contain the appropriate domain names.
|
||||||
|
|
||||||
**Update:** I've just found out about the Domain Alias sub-module, which you can enable and add aliases to each domain, so you could add the aliases in this way also.
|
**Update:** I've just found out about the Domain Alias sub-module, which you can enable and add aliases to each domain, so you could add the aliases in this way also.
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -6,8 +6,14 @@ tags:
|
||||||
- drupalcon
|
- drupalcon
|
||||||
- precedent
|
- precedent
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
[Precedent](http://www.precedent.co.uk) are sending myself and two of our other Drupal Developers to [Drupalcon Prague](http://prague2013.drupal.org).
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
[Precedent](http://www.precedent.co.uk) are sending myself and two of our other Drupal Developers to [Drupalcon Prague](http://prague2013.drupal.org).
|
[Precedent](http://www.precedent.co.uk) are sending myself and two of our other Drupal Developers to [Drupalcon Prague](http://prague2013.drupal.org).
|
||||||
|
|
||||||
Having wanted to attend the last few Drupalcons (London, especially) but not being able to, I'm definitely looking forward to this one.
|
Having wanted to attend the last few Drupalcons (London, especially) but not being able to, I'm definitely looking forward to this one.
|
||||||
|
|
||||||
See you there!
|
See you there!
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -9,6 +9,11 @@ tags:
|
||||||
- zen
|
- zen
|
||||||
- theming
|
- theming
|
||||||
---
|
---
|
||||||
|
{% block excerpt %}
|
||||||
|
How to use [Drush](https://drupal.org/project/drush) to quickly build a new sub-theme of [Zen](https://drupal.org/project/zen).
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
First, download the [Zen](https://drupal.org/project/zen "The Zen theme") theme if you haven't already done so.
|
First, download the [Zen](https://drupal.org/project/zen "The Zen theme") theme if you haven't already done so.
|
||||||
|
|
||||||
$ drush dl zen
|
$ drush dl zen
|
||||||
|
@ -27,3 +32,4 @@ The parameters that I'm passing it are:
|
||||||
This will create a new theme in sites/all/themes/oliverdavies.
|
This will create a new theme in sites/all/themes/oliverdavies.
|
||||||
|
|
||||||
For further help, type `$ drush help zen` to see the Drush help page for the zen command.
|
For further help, type `$ drush help zen` to see the Drush help page for the zen command.
|
||||||
|
{% endblock %}
|
||||||
|
|
Reference in a new issue