When you copy a custom module to app/code directory. Magento does not pick it up automatically. You need to run this.
You are here
Web development includes non-design aspects of building web sites: writing markup and coding.
6 Oct, 2018
Styled components are the best way to give some visual aid to your components. The heavy lifting should be done by a library, it can be either material design, bootstrap, semantic, etc... To adjust...
24 Jul, 2018
Helper function for converting numbers to words. There is same function available in PHPs NumberFormatter class, but using it is not always possible, since it's not enabled by default.
24 Jul, 2018
Exclude content from these tables, to get clean db backup(backup_migrate module usage). You can even use git to store your database, when you don't export cache tables.
25 Jun, 2018
You can use migrate to import field collections. It has full support. You just need to define the host entity, where you have defined the field collection.
16 May, 2018
This snippet shows you how to load a file by uri. Basically this option is available with file_load_mulitple only.
4 May, 2018
Field group lets you do some amazing forms. Still when you have empty element or the form just is too long and needs some custom modifications, you can then use prefix and suffix from form api to...
26 Mar, 2018
Delete all terms from all vocabularies in Drupal 7. This is ran by Drush, but you can run it from wherever Drupal is initialised.
12 Mar, 2018
Handles any HTTP request correctly. This is a flexible and powerful HTTP client implementation of GET, POST, PUT or any other HTTP requests. The reason I built this was due to use of url arguments...
12 Mar, 2018
Example for how to create product variation types programmatically.
20 Dec, 2017
Snippet shows you how to catch errors like 404 when you submit form using jQuery.
2 Nov, 2017
Get first n amount of characters from a string. You could use substr for that, but you will get empty results when there are special characters. Thus multibyte string method is the right way to go.
2 Aug, 2017
Instagram gives out json feed. You can use this little php snippet to create rss feed from the given json. The script leverages paging, which enables you to control the items count in the output feed.
25 Jul, 2017
React: Warning: Failed context type: The context `router` is marked as required in `Link`, but its value is `undefined`
Testing React components with Jest I got an error: "Warning: Failed context type: The context `router` is marked as required in `Link`, but its value is `undefined`.". I am using Link from react-...
1 Jun, 2017
You can minify css with optimize-css-assets-webpack-plugin, but by default some comments are left untouched. If you want to remove all comments you have to use an option for the cssnano, that is used...
1 Jun, 2017
Tutorial for serving static gzip with webpack module bundler and nginx server. When you would use nginx directly to compress the output, it would do it on the run and with some load increase the cpu...
29 May, 2017
The snippet shows how to move item to the end of array. In a case where we have an array of objects and we want to move the array item by property value. In this example I am using lodash/underscore...
23 May, 2017
This snippet encodes urls for curl. If you use special letters like äõöü in url, then you get a bit different url parsing from browsers than curl in PHP. You would think that you could use php's own...
22 May, 2017
Got an unauthorized error from htaccess passwords after https redirection implementation. This was an unexpected result, but I guess what happens is that you are redirected to access denied page...
19 May, 2017
Snippet shows you how to fix url query parameters starting with "...
19 May, 2017
Since Google says https gives websites a small ranking benefit and Let's Encrypt gives free certs, more and more sites have been converted. This is a more thurral snippet of https redirection. It has...
13 May, 2017
The Object.assign() method copies all properties from one or more source objects to a target object. It returns the target object. This can be used for cloning an object in ES6, just create an empty...
5 May, 2017
If you use full render not shallow in your tests, your tests might be rendered before the actual component and its subcomponents are fully loaded. In that case you need to delay the output, while...
19 Apr, 2017
Highcharts has paddings and spacings that will make the area charts line appear inside of the chart element. To get full width line you need to disable some spacings and lines. You have to disable...
23 Mar, 2017
Highcharts comes with a credits link by default. This snippet shows how to hide the link using the configurations.
22 Mar, 2017
No data is actually a module that needs to be loaded separately from the highcharts library. For some reason highcharts no data message is displayed below the grid. There is an easy fix of enabling...
21 Mar, 2017
You can create a vertical line on highlighted value in Highcharts. This might give a better visual when you have multiple lines. You could also use "shared: true" option in your tooltip to display...
14 Mar, 2017
You can achieve this by adding a library that supports css minify to "webpack.config.js". In this snippet I use "optimize-css-assets-webpack-plugin" which uses cssnano for minimizing by default. The...
27 Feb, 2017
You can save files to Amazon with Python using library called boto. Boto is a Python interface to Amazon Web Services and we need just a tiny part of it. If you have very large files you have to...
20 Feb, 2017
To get custom columns from a query you can use the with_entities() method to restrict which columns you'd like to return in the result. Use label() method to give AS value to your query. To use...
10 Feb, 2017
Snippet shows you how to write to temporary directory. You can either write a single file, or do stuff in a directory. In any case you should remove the files and folders after you have done your...
27 Jan, 2017
Get timestamp in seconds as integer in Python using the time library.
9 Jan, 2017
Check the HTTP Status Code of the website header using PHP. Check that url is giving valid response code of 2xx. You can modify this for different purposes. For detecting 404 not found only or...
6 Dec, 2016
Doing private Soap reqests requires some kind of authentication. One of the most common ways is to use NTML authentication. PHP soap does not support this out of the box it. You can use this tftdias...
5 Dec, 2016
This snippet shows you how to download a file from url without loading it to memory. When you use file_get_contents() and file_set_contents() you load the content to memory and then to file. The...
22 Nov, 2016
Snippet shows you how to get filename from a path in PHP. Filename and extension separately. Can be used for extending filenames with timestamp or anything.
22 Nov, 2016
Select a random file from directory. This can be useful if you want to display a random image on your website. For an example a background image randomly from a directory in your files.
12 Oct, 2016
22 Sep, 2016
How to use a DOM parser and get the contents of the body.
26 Aug, 2016
How to validate AJAX requests in Zend Framework. There is a function in request class, to use instead of comparing the $_SERVER['HTTP_X_REQUESTED_WITH'] directly. This can be beneficial for security...
19 Jul, 2016
8 Jul, 2016
There are multiple ways to display text input field. You can use lable or not, you can do some validation with regular expression. Also you can show pretty inline form errors. For more information go...
1 Jul, 2016
Since there is no File Upload form functionality in MDL, we need to create some css, html and js. I have tried to make it as simple as possible.
29 Jun, 2016
This snippet shows how to convert checkbox type inputs to MDL (Material Design Lite). There are separate classes for checkboxes in Material Design.
21 Jun, 2016
Using selectionStart, selectionEnd, setSelectionRange in jQuery example. You can't use DOM commands on jQuery objects directly, you have to get the first value of the object.
17 Jun, 2016
To hide drawer menu on large screens in MLD you have to add a class "mdl-layout--no-desktop-drawer-button" to the layout since the drawer icon is automatically rendered.
17 Jun, 2016
This snippet shows how to convert select tag to MDL (Material Design Lite). To achieve this you have to use text fields classes.
19 May, 2016
This snippet shows you how to convert po files to mo files. Po is the raw plain-text translation file with key value storage format. Mo files are compiled po files, binary format allows you to read...
17 May, 2016
Class for fetching and sending data between directo.ee API. This class includes pulling data from Directo and posting xml with php array to xml generation.
11 May, 2016
Read and decode json file in Python. You can use the same method for regular json strings.
11 May, 2016
Pretty print array, meaning that you print array, dictionary, object or any non string format in human-friendly way. This is great for terminal / command line. When you are looking for something for...
5 May, 2016
This snippet shows you how to trim an array with single line of code. This can be achieved by using "array_map".
4 May, 2016
This short snippet shows how to define an array in Python.
18 Apr, 2016
18 Apr, 2016
Snippet shows how to toggle input text using checkbox. Sometimes you need to show text field only when a checkbox is checked, that can be called conditional text field. So you need a checkbox and a...
12 Apr, 2016
8 Mar, 2016
8 Mar, 2016
24 Feb, 2016
You can use "group by" in views to group data by a field. When you start writing css for it, or even use accordion. You need to wrap the rows into a container. This can be achieved by creating a...
8 Feb, 2016
SimplePie is set to 10 seconds timeout in default. So if the feed has problem with speed then you can increase the time. The exact error that I got was "cURL error 28: Operation timed out after 10001...
3 Feb, 2016
Get current time with timezone in Python. This can be achieved using a library named arrow. It's a datetime library for correct and easy calculations using only one library.
2 Feb, 2016
Generating hmac involves using "private" key. So you you need to "double encode it". In python you can achieve it using two libraries hashlib and hmac.
1 Feb, 2016
Add column collation to column creation in SQLAlchemy. Optional, a column-level collation for use in DDL and CAST expressions. Renders using the COLLATE keyword supported by SQLite, MySQL, and...
30 Jan, 2016
If you plan to use Python for your web backend then you might want to consider Django as there are many good libraries that you need for web development.
29 Jan, 2016
Using SQLAlchemy to create table columns. To use numeric data types you have to use mysql dialects.
13 Jan, 2016
How to find out the amount of between two dates. For an example how many days have passed since a defined date.
11 Jan, 2016
Getting every other member of array in PHP. Examples of getting every other odd and even numbers.
10 Jan, 2016
Phar is included in PHP 7 amongst other updates. It's no longer external module. You have to turn off the "readonly" parameter. Since it disables Phar write support by default.
5 Jan, 2016
When you create a simple request without any special REST client, you can do it just by using curl. When you need to do curl request, it's not a good practise to do it on every page load. So the...
4 Jan, 2016
To explode multiple delimiters PHP you have to use regular expression. Add your delimiters in the parentheses separated by pipe. You might have to escape your characters if they have meaning in PCRE...
9 Dec, 2015
Using PHP to read csv file is a common thing to do. Sadly there is no solid standard on delimiters, depends on fully from where you get your csv file. Usually simple csv exports are a bit different...
29 Nov, 2015
Changing line item price is not as easy as you could think. It can seem that the price has changed, but there are multiple places where you have to actually change it. Especially when you compute the...
25 Nov, 2015
19 Nov, 2015
Just a snippet that shows how to check if current user has edit permissions for some node in Drupal 7. Using node_access function like in the example you are also able to check permissions for...
9 Nov, 2015
This nifty little snippet will scan your module for tpl.php files.
8 Nov, 2015
Using Python in the web. Setup Apache the way that you can run Python backend on it.
7 Nov, 2015
Check if a python module is installed or not on the system. The simplest way to do it is in terminal.
6 Oct, 2015
Select next, is a functionality well needed in everyday programming. For an example, if you have a function that defines a variable and the variable is used multiple times. You would like to select...
8 Sep, 2015
You can replace all whitespaces (space, new lines, etc.) with a single space using regular expression find and replace.
4 Sep, 2015
PhpStorm by default does not display line numbers. Working with version control or when debugging stuff, you usually get line number of the code where the error appears. So it would make sense that...
13 Jul, 2015
Snippet shows how to uninstall modules programmatically. This is not deleting the files, but doing a full uninstall.
12 Jun, 2015
Get cursor position in CKEditor is simple if you know some facts. You have to have the instance initiated, so simple jQuery ready would not work. You can get selection and use that functionality to...
17 May, 2015
Apache default configuration can be a bit slow in case of today's standard web applications. Especially on local environment where you develop your application, class, framework or plain old PHP from...
23 Mar, 2015
Getting URL query parameters array where unwanted elements are removed. For that you can use drupal_get_query_parameters function. In default q parameter will be removed. That parameter includes...
5 Mar, 2015
How to get values by key name in multidimensional array. You have to iterate it recursively. This is the first time I can use Iterator classes of PHP and I already can think multiple problems this...
4 Mar, 2015
Sending data using POST to external url should be done by using drupal_http_request.
22 Feb, 2015
If you are using larger files like bigger data files or images, memory might become an issue. Even if not, it's always good practice to use optimal amount of memory. Clearing memory is just a part of...
18 Feb, 2015
Edit field output after the field module has performed the operation. This gives you possibility to alter the field output before rendered in your module. This works with display suite and other...
17 Feb, 2015
Create or generate .htpasswd file from command line in Linux. The file is used for password protected websites in Apache. The easiest way to create one is to generate it from terminal.
10 Feb, 2015
Since this snippet includes a lot of information the title is simply a bunch of keywords. Basically we are using file uri to determine if it exists and is managed or needs to be saved as new managed...
5 Feb, 2015
The idea would be that you don't take any values directly from node_load result. You can either use entity wrapper(is not a part of this tutorial) or field get and view functions.
3 Feb, 2015
Entity API provides wrapper classes that make dealing with the values of an entity's properties and fields easier. This post is to make the information easy to learn by examples.
29 Jan, 2015
I had an error in "jquery.ui.mouse.min.js" when using jQuery 1.9 (or newer) with jQuery UI 1.8 (or older). This jquery plugin is used to restore deprecated functionalities in jQuery and removed as of...
5 Dec, 2014
This "tutorial" is how I created wildcard subdomains in my localhost. So I get domains like "http://bt.localhost". This bit is from my http.conf or apache.conf depending on your system. There also...
2 Nov, 2014
PCRE regular expression operator OR. In regular expressions "or" is known as "alternatives". Create a subgroup using parenthesis.
29 Oct, 2014
Search and replace using regular expression in PHP using preg_replace function. It is very powerful way to search and replace. I suggest using some online regular expression tool to test out your...
24 Oct, 2014
In general we are going to embed pdf in html. For this tutorial I am going to use PDF.js. It is a web platform for parsing and rendering PDF files. Canvas support is one of the main things that is...
24 Oct, 2014
This is how you can load menu items children. Also the example / snippet is about how you can get the first child, but the menu has to be in a single language tough. It takes access and being hidden...
2 Oct, 2014
This snippet shows you how to get menu link id (mlid) from node id (nid) using a simple query generated by abstraction layer in Drupal 7.
30 Sep, 2014
This snippet shows you how to get a single query result as string in Drupal 7, using database abstraction layer select.
23 Sep, 2014
Install phpMyAdmin for Apache on Arch Linux so that it would open under "pma.localhost". This works on other distributions as well just use your specific package manager to download the packages and...
25 Aug, 2014
There are many functions for menus, but since Drupal is not hierarchical but is modular, that's why menu doesn't have node requirement and the opposite way around. So this snippet shows how to get...
5 Aug, 2014
Compress site using mod_deflate to reduce bandwidth and loading time, also Google Speed suggests it. You can test your site via whatsmyip.org/http-compression-test. Add this to your .htaccess file,...
23 Jun, 2014
This tutorial shows how to set up Apache, PHP and MariaDB (drop-in replacement for MySQL). You can use pacman instead of yaourt on installing the server, since yaourt doesn't come with Arch in...
28 May, 2014
PHP array of iso country list. This list includes Kosovo (KV) and Democratic People's Republic of Korea (KP). That I found hard to find from somewhere else.
7 May, 2014
This function checks whether a string is valid UTF-8. You can ensure that the string you operate is a valid UTF-8 string. preg_match fails on strings containing invalid UTF-8 byte sequences. It does...
1 May, 2014
This snippet shows you how to create contextual links in Drupal 7. If you don't know what contextual links are then those are the links in front end that come up from the ratchet.
29 Apr, 2014
How to install any version of Drupal using Drush the Drupal Shell. You can replace the version name with the version you like. Also feel free to replace words in caps to get an installation that you...
28 Apr, 2014
Protect site with password using htaccess. The htpasswd file is just a text file that includes usernames and password hashes. You can generate those by using online tools for generating htaccess...
24 Mar, 2014
Sometimes menu gets messed up and all the new links go on the admin menus first level. Or you have other reasons to rebuild menu. You also need devel module to do this.
24 Mar, 2014
This shows code examples of what I had to do to create custom pane programmatically for Panels in Drupal 7. In this example I create new pane where you can pick your node and display it.
14 Mar, 2014
First you need to add the connection information of the other database. This way you can use drupal database abstraction layer for altering any database.
10 Mar, 2014
This tutorial describes how you can group the results of a view by first letter of their title. This might not suit for you in two cases, first if you need to order them by ascii not utf-8, secondly...
7 Mar, 2014
There is a module called migrate that enables you to migrate content to Drupal. This snippet shows you how to migrate image from URL to Drupal 7. You have to get file name from the importing source...
26 Feb, 2014
I had a problem with path breadcrumbs where I couldn't get taxonomy therms through commerce product reference. So I had to disable the path breadcrumb for the node and do it manually. I didn't want...
21 Feb, 2014
Add content to view header, footer, before or after using hook_views_pre_render() in Drupal 7. Using hook_views_pre_render gives you the opportunity to use values from executed views query.
20 Feb, 2014
Change or update field instance programmatically in Drupal 7. For more information check out Field CRUD API in drupal.org.
2 Jan, 2014
Checking that variable is a jQuery object. We are going to use instanceof and it returns true if the statement is true.
2 Jan, 2014
Use hook_page_build() instead of hook_init() to add CSS or JS to every page. The reason is that hook_init() runs on every request that goes to Drupal (AJAX requests, private file requests, boost /...
25 Nov, 2013
Encodes special characters in a plain-text string for display as HTML. Validates strings as UTF-8, if not UTF-8 it returns an empty string. It prevents CSS attacks on IE 6.
20 Nov, 2013
This tutorial shows how to prepare a Debian Wheezy web server. This is just a simple setup of basic web server. I myself did it to set up a development environment for myself.
15 Nov, 2013
This snippet shows you how to change date format for better exposed filters in Drupal 7. I was not able to use strtotime with the default setting.
14 Nov, 2013
Installing module programmatically in Drupal 7 can be achieved with just one step, using module_enable function.
5 Nov, 2013
Check if text contains cyrillic characters in PHP. This example shows you how to do exactly that.
5 Nov, 2013
Converts URLs in text into links in Drupal 7 automatically. Three types of "links" get converted. URLs like http://example.com, e-mail addresses like email@example.com and urls without the "http://"...
29 Oct, 2013
Form submitting is really simple with jQuery. You can use submit function to submit form or catch a form submission and do something else.
7 Oct, 2013
This snippet shows how to get taxonomy vocabulary id (vid) by machine name of taxonomy vocabulary Drupal 7.
3 Oct, 2013
This snippet shows you an example of using image_scale_and_crop function to scale and crop image as in image styles.
16 Sep, 2013
How to split words in string to an array using regular expressions. You can use this for search indexing for an example.
2 Sep, 2013
List of useful hooks and functions in Drupal 7. You can find here something new or just bookmark it for your reference.
21 Aug, 2013
Change or add file icons to Drupal 7. First you have to define your mime type of a file, if it isn't done already. Then add icon URL to that mime type (16x16).
14 Aug, 2013
8 Aug, 2013
This example shows you how to create time field using date module and Field API in Drupal.
7 Aug, 2013
This tutorial shows how to parse RSS feeds with PHP. From the libraries and methods that I have tested and used SimplePie is by far the best PHP RSS parser. It supports most common RSS modules out of...
6 Aug, 2013
This snippet shows you how to convert file size in bytes to nice (human-readable) format in PHP. If the size is less than 1 MB, show the size in KB, if it's between 1 MB - 1 GB show it in MB, etc.
30 Jul, 2013
This example shows how to alter filter in views exposed filters using form_alter in Drupal 7.
25 Jul, 2013
Snippet about getting img tag image url from html using regex in PHP. Example below.
14 Jul, 2013
This snippet shows you how to customize views RSS feed title in Drupal. This example shows you how to create title for taxonomy feed, so that the title would be the term with it's parents.
12 Jul, 2013
How to use colorbox module programmatically. Colorbox module provides with loading inline content, explained here: https://drupal.org/node/1971564. Since that didn't work for me, I tok a different...
12 Jul, 2013
This tutorial shows you how to exclude current node from view. For an example, if you need a block that shows related content by taxonomy then you want to exclude current node from the list.
7 Jun, 2013
This snippets shows you how to create lists the right way using theme_item_list.
28 May, 2013
This simple snippet shows you how to add body class programmatically from your module in Drupal 7.
20 May, 2013
Creating views view in your module is really simple.
7 May, 2013
Convert time and date from one time zone to another in PHP.
19 Apr, 2013
This snippet shows how to remove HTML elements using DOMDocument in PHP. The problem is that you can't do it in the same loop.
15 Apr, 2013
Sometimes you need to parse HTML with PHP. There are many different ways. It's hard to parse HTML, people write incorrect HTML very often. This code forces DOMDocument to read and later write HTML.
5 Apr, 2013
Sometimes you have to make button that skips form field validations. For an example Cancel button. This snippets shows how to skip form validation for button. Works in Drupal 7.
3 Apr, 2013
How to translate localized taxonomy terms in Drupal 7.
7 Mar, 2013
You can use "is" to see if the form element is disabled.
19 Feb, 2013
How to override page title in your theme, after all modules have done their jobs.
8 Feb, 2013
How to display message before closing the page or moving to another page. Don't use this to annoy people. Sometimes this functionality is still useful, for an example if you have some sort of unsaved...
8 Feb, 2013
This snippet shows how to remove form elements in Drupal. I am using hook_form_alter and access parameter from form api.
2 Feb, 2013
Rather than simply dumping the HTML into the page you might want it to be animated. You can .hide() the content before doing a .prependTo(), then call .slideDown() on the element.
27 Jan, 2013
Changing page titles in your theme. There is also hook_page_title_alter hook. If for some reason you still want to do it your theme, then this is how.
23 Jan, 2013
How to use select query as where clause in Drupal views module query alter. You can't use hook_views_query_alter, because it places single quotes around the value. So you can't use query instead of...
1 Dec, 2012
This snippet shows you how to Localize taxonomy term in Drupal 7.
29 Nov, 2012
Remove width and height attributes from img tag using PHP. Really plain and simple replace width and height attributes with nothing.
28 Nov, 2012
You can only change event colors by content type or taxonomy terms in Calendar view. More advanced coloring requires some programming.
23 Nov, 2012
How to turn plain text URLs into active links in Drupal.
21 Nov, 2012
19 Nov, 2012
This example shows how to create monocrome Google Maps. Where the map will be using only shades of grey (with or without black and/or white). It might also be called grayscale or black-and-white.
25 Oct, 2012
This snippet shows how to use jQuery datepicker in Drupal. Drupal already includes jQuery and jQuery UI in its core. So you just have to make sure it's loaded and then you can use it in your scripts.
2 Oct, 2012
Creating range array where key and the value is the same number. I am using array_combine function for that. I give two parameters which are the same array created by range.
23 Sep, 2012
Drawing a rectangle in canvas tag with rectangle functions.
30 Aug, 2012
Creating email field. The field is still textfield, you just have to make validation for the field.
23 Aug, 2012
Creating your own template files that you can use in your modules in Drupal 7. Template files are for separating HTML from PHP. This tutorial shows you how to create and use tpl.php files. Template...
22 Aug, 2012
Programmatically create menu link language relation in Drupal 7. This example takes a certain taxonomy vocabulary by id and creates language relations to menu links by terms relations. You might need...
21 Aug, 2012
This query gets node created dates and selects all years of nodes that has been made. Also there are filters: node.status equals 1 is published filter, node.type is content type filter and node...
14 Aug, 2012
How to make sure your cron task runs once per day in Drupal? You can set crontab once per day, but you still might want to run cron manually every now and then. Also you might have to change the cron...
9 Aug, 2012
Strip tags in PHP strips all tags, except allowed tags. This function strips tags that you define. Also you can define if you want to strip content as well.
23 Jul, 2012
This function strips tags by any identifier without regexp, and without heavy XML parsing. As long as the tag looks exactly the same in source-code it works.
12 Jul, 2012
Create table using theme table in Drupal. This is the simplest example of creating table. In the code I added link to the documentation. You can do things like add classes, caption, colgroups etc.
25 Jun, 2012
Show Drupal 404 page programmatically. Just return this function from your page function.
29 May, 2012
Example how to get field types in MSSQL. You can use it on any query, even procedures.
14 May, 2012
This snippet shows you how to get date on mouseover from cell in jQuery UI datepicker.
2 May, 2012
How to add node to nodequeue using a little code. You can make it automatic using Rules and PHP filter module(in core that adds option to add PHP code to textarea).
2 May, 2012
Translate block title in Drupal 7 using this theme hook.
26 Apr, 2012
Detect character encoding in PHP and convert string to UTF-8.
20 Apr, 2012
Drupal SQL query examples, includes regular query and select, insert, update and insert or update using abstraction layer. Explanations of different data return types like fetchassoc, fetchall and...
6 Apr, 2012
How to fix page titles for taxonomy term pages. It creates title from term hierarchy. You have to remove the views title override.
6 Apr, 2012
Load taxonomy term object by name or tid. Also how to get term parents from top to bottom.
5 Apr, 2012
This shows you how to get the path of the current URL and assign it to a variable. This is achieved by taking url from location object. The location object also has other properties, like host, hash...
13 Mar, 2012
How to get term name in right language in Drupal? Internationalization (i18n) module is used for localization.
3 Mar, 2012
How I set up my multi-site in localhost so that my different sites would be in different sub-folders. I did it on my windows machine.
17 Feb, 2012
How to get all tables names that are in a certain table.
9 Feb, 2012
How to remove language links from node links in Drupal 7
26 Jan, 2012
How to change file name programmatically after file is saved in Drupal 7.
23 Jan, 2012
First you need to create a filter to your views. Add "Feeds log: Importer id" filter to All entries display / tab. Then this code snippet alters the form so there won't be textfield, but selection.
16 Jan, 2012
How to remove views view filter programmatically in Drupal.
19 Dec, 2011
This code snippet is about creating languages form field in Drupal 7 using field api.
14 Dec, 2011
Getting MySQL tables names in PHP.
14 Dec, 2011
How to get MySQL columns data of a table in PHP. The data includes name, type, null allowed or not, key, default value and extra for auto_increase and such.
13 Dec, 2011
How you can add field to an entity programmatically in Drupal 7.
8 Dec, 2011
Adding body classes in Drupal 7. Just a little code snippet that can be useful in some cases.
4 Dec, 2011
Make a group of checkboxes behave like radiobuttons.
29 Nov, 2011
How to display eck form anywhere you wish, just few lines of PHP can make you a big head ache.
15 Nov, 2011
Redirect users to their main language first visit. I needed it only on the front page, but you can simply remove the if statement if you need the functionality on every page. The language detection...
23 Oct, 2011
How to create forms that are submitted via ajax. To understand this tutorial you have to have a basic knowledge of Drupal programming and its form api.
11 Oct, 2011
Check if URL is external or internal in PHP. We are going to use parse_url PHP native function. Function parse_url parses a URL and returns an associative array containing any of the various...
8 Oct, 2011
How to redirect everything to certain page like index.php or root.
1 Oct, 2011
22 Sep, 2011
Selecting from multiple tables using ActiveRecord in CodeIgniter. Basics are the same as in query. You select multiple tables, relate tables and select the output fields.
21 Sep, 2011
19 Sep, 2011
To change breadcrumb in module you can use two functions. You can change breadcrumbs separators or the whole logic using theme_breadcrumb in your templates template.php file.
18 Sep, 2011
This function embeds views view in Drupal. This function doesn't display the title of the view.
8 Sep, 2011
How to get taxonomy term depth or level in Drupal 7.
8 Sep, 2011
How to get vid - vocabulary id by vocabulary name in Drupal 6. You can get it by using this little function.
22 Aug, 2011
How to test execution time of any part of the code in PHP. Basically you have to start counting microseconds before you code execution and stop after. This snippet shows how to do the counting.
20 Aug, 2011
How to get taxonomy vocabulary id(vid) by machine name in Drupal.
20 Aug, 2011
Sometimes it's hard to set the title you want for your views. So you have to do this programmatically in your module. This snippet shows you how.
17 Aug, 2011
How to edit views content before rendering the view. This is what you need in your Drupal 7 module.
16 Aug, 2011
9 Aug, 2011
How to hide default /node page from viewers. It's useful to do this if you don't use the page. People might access to some unwanted places.
8 Aug, 2011
How to make enter insert br tag instead of p tag. Works when using WYSIWYG module and ckeditor or tinymce.
8 Aug, 2011
This menus page shows child menus under that menu item.
7 Aug, 2011
This snippet shows how to change page title on search page. For this example the title will be the content of search box(search string).
4 Aug, 2011
How to include module file to anywhere. For an example if you want to spread up your functions in different files for structure and readability then this is the right way of including module files.
29 Jul, 2011
How to print sub-menus or any level menus in Drupal 7. You get only sub-menus of the current page you are on.
27 Jul, 2011
I used theme hook called theme_css_alter. There is an array where are the css files. Foreach loop to go through them and unset ones that shouldn't be there. This one goes to your themes template.php...
22 Jul, 2011
Menu delimiters or separators in Drupal. Tested on Drupal version 6.
21 Jul, 2011
By placing this code to your themes template.php file, you get search results grouped by node/content type.
19 Jul, 2011
This snippet shows you how to load a blocks content programmatically. You can use this way to display a block anywhere you want.
18 Jul, 2011
This snippet shows how to redirect form after submitting and saving in Drupal 7. You can also use Rules module for this.
17 Jul, 2011
16 Jul, 2011
This little snippet shows you how to create roles programmatically in Drupal 7.
16 Jul, 2011
Creating content types programmatically in Drupal 7. If you add this code to install hook then this way you can define your own content types in a module for an example.
10 Jul, 2011
Save file or image programmatically. First get file from directory or URL. Then save the image and assign it to the field you wish.
8 Jul, 2011
This snippet gets content type of a file form external url. This snippet uses curl to download the file and get the content type.
7 Jul, 2011
How to create custom language switcher. You can write your own tags and classes to get completely custom language switcher.
29 Jun, 2011
This snippet sends form with id contactform using ajax via post method. When it's send and result is returned. It writes result into #feedback-form.
29 Jun, 2011
To always have latest jQuery version, you can use this fast loading jQuery library from Google.
23 Jun, 2011
How to get node ids of certain content type in Drupal.
21 Jun, 2011
To add add dependencies to Drupal modules you have to open your modules .info file. Add new line "dependencies = module_machine_name" and you are done.
19 Jun, 2011
How to order views programmatically. You might need to do this on special occasions. This hook initializes before query is built so it goes for all data, not just current page.
17 Jun, 2011
This snippet is a code from my module that just makes a simple menu item into my admin menu in Drupal 7. I am using menu_hook function to achieve this.
16 Jun, 2011
This snippet shows how to check if jQuery selector exists.
1 Jun, 2011
Adding your css stylesheet to TinyMCE editor in WordPress admin panel.
30 May, 2011
How to remove RSS feed from head tag in your template.
24 May, 2011
Getting and save window scroll position with jQuery. You also need cookie plugin to store the position value in cookies, so it can be used after browser page changes.
23 May, 2011
How to make a widget that has one textbox and custom html output in WordPress.
15 May, 2011
How to get node path alias in Drupal. All you need to know is node id(nid).
14 May, 2011
How to add taxonomy terms programmatically in Drupal 7.
12 May, 2011
How to get posts from multiple categories using get_posts function.
10 May, 2011
How to place Drupal node comment form to anywhere in your module or theme.
8 May, 2011
How to turn MySQL query into an array in PHP. Print query results on screen. This is useful for determining contents of a table.
3 May, 2011
How to get current, last and coming year in PHP. Simple examples of how you can get different years. Currently the years are calculated from the server time.
29 Apr, 2011
This snippet shows how to get html element textareas value or text with jQuery.
26 Apr, 2011
This example shows you how to get base URL of your wordpress powered website. It takes the value from your site information which can be modified and was set during the installation of WordPress.
22 Apr, 2011
ColorBox for images is loaded on first load, so all images loaded by ajax are colorBox free. To enable ColorBox for ajax loaded images you have to scan the html for images after load is complete....
21 Apr, 2011
You can enable or disable comments programmatically. Get node using node_load, set comment value and save node.
17 Apr, 2011
Center floating divs or menus or any kind of floats using css.
17 Apr, 2011
First find this line: $form['path']['pathauto_perform_alias'] = array( Then add: '#value' => 1,
7 Apr, 2011
6 Apr, 2011
This tutorial shows how to get taxonomy terms names in Drupal 7. First how to get all taxonomy terms, how to get categories by a parent and with a little effort, you can turn it into a treeview.
17 Mar, 2011
I needed to get some xml data and generate nodes out of them. This shows how I created nodes programmatically from my module in Drupal 7. I also suggest looking into creating a node using entity...
14 Mar, 2011
How to get profile fields in Drupal 7. Profile fields are made with Profile2 module.
12 Mar, 2011
This beginners tutorial shows how to create a durpal module. We will set up a module, create a menu item and a "Hello World" page.
11 Mar, 2011
How to get full/absolute url of the page you are currently visiting.
24 Feb, 2011
This tutorial shows how to create background text to your search box that will dissapear on click/focus.
22 Feb, 2011
20 Feb, 2011
This tutorial shows how to add or append zeros before numbers. You might need this if you want to make folders named by numbers and you want them to be in right order when browsing the folder with...
19 Feb, 2011
This tutorial shows how to send a single form field/input of a form. We are going to use jQuerys ajax features to do that.
9 Feb, 2011
This tutorial shows you how to get values of checkbox array using jQuery. You can use this to send selected checkboxes values with ajax or add those to url variable(like in this example). If you...
4 Feb, 2011
You can use these examples to change img tags src attribute or any attribute of any tag.
29 Dec, 2010
How to make Internet Explorer only CSS files for Drupal themes.
20 Dec, 2010
Installing Google App Engine SDK on Ubuntu or any linux distribution.
17 Dec, 2010
How to install and set up Yii framework application to your hosting.
15 Dec, 2010
This tutorial shows how you can add text to images with PHP. You can use it to make banners with dynamic content for an example.
6 Dec, 2010
Examples of parsing array values on screen. Some examples for beginners.
6 Dec, 2010
This tutorial shows you how to make a custom node layout. Which is a custom placement of node fields. Also we do it without any coding.
30 Nov, 2010
HTML symbol codes are used to replace symbols so they would fit in ASCII codes. Also to remove certain symbols so content wouldn't interfere with HTML.
30 Nov, 2010
This tutorial shows how to show multiple nodes on one page. Just like front page but not with a checkbox but different content type. Views are used for this.
12 Nov, 2010
Easy to understand tutorial on how to upload, store and display images in mysql database.
12 Nov, 2010
Upload form allows users to upload files through their browsers.
20 Oct, 2010
19 Oct, 2010
Drawing a circle in canvas tag with arc function is actually really simple, but you have to have a browser that supports HTML5.
19 Oct, 2010
HTML5 introduces a number of new elements and attributes that reflect typical usage on modern websites. The new standard incorporates features like video playback and drag-and-drop that have been...
9 Oct, 2010
An easy example of recursion. PHP treeview can be used to create hierarchical lists like menus including sub-menus, category trees, taxonomy trees or site maps. This tutorial shows you how to...
25 Sep, 2010
Getting data from JSON with jQuery is really simple.
24 Sep, 2010
This tutorial shows you how you can generate JSON from SQL data that comes from model. Converting query to JSON is really simple in PHP and even simpler in CodeIgniter.
20 Sep, 2010
How to make login system for CodeIgniter using OpenID. This example uses Google Accounts for login.
19 Sep, 2010
This tutorial shows you how you can cache code in CodeIgniter, by saving string or plain text into a file.
12 Sep, 2010
This tutorial shows you how to make round corners for divs. From scratch with and without jQuery UI library.
3 Sep, 2010
This tutorial shows how you can make 100% height and width layouts with footer that stays always at the bottom of the page.
26 Aug, 2010
25 Aug, 2010
22 Aug, 2010
In this tutorial we will make RSS 2.0 feeds from latest posts in your site.
18 Aug, 2010
This tutorial shows how to make RSS feeds in Python for Google App Engine.
16 Aug, 2010
Fourth part of AppEngine Forms. This time we delete added rows from database.
16 Aug, 2010
Third part of AppEngine Forms. This time we are making edit from.
16 Aug, 2010
Tutorial about making forms in AppEngine with Python. First part.
16 Aug, 2010
Second part of AppEngine Forms. This time we will try to get our data through post and save the data to database.
8 Aug, 2010
This tutorial shows different kinds of HTML lists. There are lists with bullets, numbers, etc...
3 Aug, 2010
This tutorial shows how to make Log In, Log Out and Register links for Google App Engine in Python.
1 Aug, 2010
This tutorial shows you how to get your domain name(base url) from address bar in Google AppEngine, using self and urlparse
25 Jul, 2010
25 Jul, 2010
25 Jul, 2010
This tutorial shows how to do URL routing in CakePHP, if you need your URL to be without controller and view.
24 Jul, 2010
This tutorial shows how you can attach dynamic menu or any content to layout that you still want to call from controllers.
22 Jul, 2010
This tutorial shows how to install CakePHP. After this tutorial you can start making web application.
15 Jul, 2010
Tutorial about global variables in PHP. How to use global, superglobal in PHP.
5 Jul, 2010
3 Jul, 2010
This tutorial shows how to use Cascading Style Sheets in Google AppEngine. It's all about url mapping. You have to have some basic setup of a project to follow this tutorial.
26 Jun, 2010
Some knowledge of CI and OOP could be handy. This tutorial shows how to submit Ajax forms in CodeIgniter using jQuery. With optional jQuery UI feedback bubbles.
25 Jun, 2010
This tutorial is about using and converting timestamps in PHP, witch are common formats of storing some timeperiod in database.
16 Jun, 2010
This tutorial shows you how to set up WYSIWYG TinyMCE in CodeIgniter. Both versions standalone and jQuery. It's really easy, most time takes the sample code tweaking.
13 Jun, 2010
This tutorials shows how to set up NetBeans IDE for writing Python for Google App Engine. Using NetBeans IDE is optional, you can complete the tutorial by skipping all the NetBeans related steps.