<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 12:47:24 +0000</lastBuildDate>
    <item>
      <title>(PHP) If a 'bin' exists in the user home, then add that to the PATH. - berkes</title>
      <link>https://snipplr.com/view/29590/if-a-bin-exists-in-the-user-home-then-add-that-to-the-path</link>
      <description>&lt;p&gt;Put this line in your .bashrc. &#13;
If the user has a directory named 'bin' then that will be added to the PATH.&#13;
All scripts in that path (wich are executable) will be available as commands to that user.&lt;/p&gt;</description>
      <pubDate>Thu, 11 Mar 2010 03:16:36 UTC</pubDate>
      <guid>https://snipplr.com/view/29590/if-a-bin-exists-in-the-user-home-then-add-that-to-the-path</guid>
    </item>
    <item>
      <title>(PHP) Routine to update and set variables in Drupal using hook_update - berkes</title>
      <link>https://snipplr.com/view/29499/routine-to-update-and-set-variables-in-drupal-using-hookupdate</link>
      <description>&lt;p&gt;Drupal allows hook_update_N to run any sort of code. Most of the time, however, people only use this to alter the database scheme. &#13;
But you can use it for much more. Like setting variables, creating nodes, importing views and so on. &#13;
This code shows how to set a series of variables in Drupal.&#13;
&#13;
When you deploy this code, running update.php will set all the variables as in the listing.&#13;
&#13;
I typically catch this in a module called 'projectname_meta'. So this function would go in projectname_meta.install, and will be called from projectname_meta_install and projectname_meta_update_5002, for example.&lt;/p&gt;</description>
      <pubDate>Tue, 09 Mar 2010 09:00:47 UTC</pubDate>
      <guid>https://snipplr.com/view/29499/routine-to-update-and-set-variables-in-drupal-using-hookupdate</guid>
    </item>
    <item>
      <title>(PHP) Howto run your own functions on any forms submission. - berkes</title>
      <link>https://snipplr.com/view/28546/howto-run-your-own-functions-on-any-forms-submission</link>
      <description>&lt;p&gt;By using hook_form_alter, you can add your own callback functions to any Drupal form. &#13;
These functions will be called when Drupal validates the form and when Drupal submits it.&#13;
&#13;
In example below, a module called 'simple_checkout' adds its own handlers to a form called 'ideal_payment_api_issuer_form'. That latter is generated by another module, but we can fill our own tables and run our own validation *in addition to those by the originating module*.&lt;/p&gt;</description>
      <pubDate>Thu, 18 Feb 2010 09:19:37 UTC</pubDate>
      <guid>https://snipplr.com/view/28546/howto-run-your-own-functions-on-any-forms-submission</guid>
    </item>
    <item>
      <title>(PHP) make a tarball of only the changed directories in a git repos, since last tag. - berkes</title>
      <link>https://snipplr.com/view/27536/make-a-tarball-of-only-the-changed-directories-in-a-git-repos-since-last-tag</link>
      <description>&lt;p&gt;make a tarball of only the changed directories in a git repos, since last tag.&#13;
replace {tagname_last} with any name you siwh to give the tarball&#13;
replace {tagname_previous} with a git reference (like a tag) from which you want to zip the changes.&lt;/p&gt;</description>
      <pubDate>Tue, 02 Feb 2010 02:26:20 UTC</pubDate>
      <guid>https://snipplr.com/view/27536/make-a-tarball-of-only-the-changed-directories-in-a-git-repos-since-last-tag</guid>
    </item>
    <item>
      <title>(PHP) Remove Drupal's search block "search this site" label. - berkes</title>
      <link>https://snipplr.com/view/27483/remove-drupals-search-block-search-this-site-label</link>
      <description>&lt;p&gt;Wizzlern, a Dutch Drupal trainer, has a Dutch article online on how to remove the "search this site" label in the Drupal search-block.&lt;/p&gt;</description>
      <pubDate>Mon, 01 Feb 2010 09:41:26 UTC</pubDate>
      <guid>https://snipplr.com/view/27483/remove-drupals-search-block-search-this-site-label</guid>
    </item>
    <item>
      <title>(PHP) Target=_blank in Drupal link - berkes</title>
      <link>https://snipplr.com/view/26499/targetblank-in-drupal-link</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 15 Jan 2010 07:17:14 UTC</pubDate>
      <guid>https://snipplr.com/view/26499/targetblank-in-drupal-link</guid>
    </item>
    <item>
      <title>(PHP) Track block/views/cck etc changes in RCS and migrate with Drupal updates. - berkes</title>
      <link>https://snipplr.com/view/20886/track-blockviewscck-etc-changes-in-rcs-and-migrate-with-drupal-updates</link>
      <description>&lt;p&gt;Takes a .sql file and runs trough that, each line as an update_sql. &#13;
Very usefull to track and migrate your blocks/views/cck etc changes.&lt;/p&gt;</description>
      <pubDate>Fri, 09 Oct 2009 09:08:00 UTC</pubDate>
      <guid>https://snipplr.com/view/20886/track-blockviewscck-etc-changes-in-rcs-and-migrate-with-drupal-updates</guid>
    </item>
    <item>
      <title>(PHP) Drupal function to return contents of a databasetable (for Debugging) - berkes</title>
      <link>https://snipplr.com/view/7637/drupal-function-to-return-contents-of-a-databasetable-for-debugging</link>
      <description>&lt;p&gt;Drupal helper function to debug a table. Returns the contents and some explanation of a database table in a rendered format (HTML table).&#13;
&#13;
**NOTE** You REALLY do not want to put this function behind any kind of menu_callback and/or on other pages. Use it for debugging only: Because we return any contents, regardless of permissions and so forth, you potentially open up your site to data mining and or session hijacking!&lt;/p&gt;</description>
      <pubDate>Fri, 01 Aug 2008 12:02:21 UTC</pubDate>
      <guid>https://snipplr.com/view/7637/drupal-function-to-return-contents-of-a-databasetable-for-debugging</guid>
    </item>
    <item>
      <title>(PHP) Allow per-region template overrides. - berkes</title>
      <link>https://snipplr.com/view/5042/allow-perregion-template-overrides</link>
      <description>&lt;p&gt;A per-region override. &#13;
ogt_blocks is ran for a region, if a region contains blocks, we search for a theme function named theme_region_regionname(). If exists, we run that, else we just return the concatenated blocks for that region.&lt;/p&gt;</description>
      <pubDate>Wed, 13 Feb 2008 09:18:37 UTC</pubDate>
      <guid>https://snipplr.com/view/5042/allow-perregion-template-overrides</guid>
    </item>
    <item>
      <title>(PHP) Easy debug variable to find what vars are available in a tpl.php file - berkes</title>
      <link>https://snipplr.com/view/5039/easy-debug-variable-to-find-what-vars-are-available-in-a-tplphp-file</link>
      <description>&lt;p&gt;An easy debug trick: gives you a variable that you can print in any tpl.php to find out what vars you have available there.&lt;/p&gt;</description>
      <pubDate>Wed, 13 Feb 2008 03:30:30 UTC</pubDate>
      <guid>https://snipplr.com/view/5039/easy-debug-variable-to-find-what-vars-are-available-in-a-tplphp-file</guid>
    </item>
    <item>
      <title>(PHP) Override specific links in theme_links based on their class. - berkes</title>
      <link>https://snipplr.com/view/4560/override-specific-links-in-themelinks-based-on-their-class</link>
      <description>&lt;p&gt;Place the first function, phptemplate_links() in your template.php file. Alternatively (and IMO better) is to name the function your_theme_name_links() where your_theme_name is the name of your theme.&#13;
&#13;
From here on, you can add theme functions like your_theme_name_links_comment_add(), whom will render the specific links with the comment_add class.&lt;/p&gt;</description>
      <pubDate>Mon, 14 Jan 2008 09:44:47 UTC</pubDate>
      <guid>https://snipplr.com/view/4560/override-specific-links-in-themelinks-based-on-their-class</guid>
    </item>
    <item>
      <title>(PHP) Assure hooks in a Drupal module are ran before the others. - berkes</title>
      <link>https://snipplr.com/view/4449/assure-hooks-in-a-drupal-module-are-ran-before-the-others</link>
      <description>&lt;p&gt;Sets a module's weight to the lowest number. This assures that your module is ran before all other modules. Userfull if you want your implementation of a hook to be ran first.&#13;
Add this to your .install file. Replace your_modulename with the name of your module.&lt;/p&gt;</description>
      <pubDate>Thu, 03 Jan 2008 10:14:27 UTC</pubDate>
      <guid>https://snipplr.com/view/4449/assure-hooks-in-a-drupal-module-are-ran-before-the-others</guid>
    </item>
    <item>
      <title>(PHP) Print errors to screen on default php5 in Drupal - berkes</title>
      <link>https://snipplr.com/view/4440/print-errors-to-screen-on-default-php5-in-drupal</link>
      <description>&lt;p&gt;Add these lines to Drupals settings.php. Probably works on other systems, then Drupal too.&lt;/p&gt;</description>
      <pubDate>Wed, 02 Jan 2008 03:52:03 UTC</pubDate>
      <guid>https://snipplr.com/view/4440/print-errors-to-screen-on-default-php5-in-drupal</guid>
    </item>
    <item>
      <title>(PHP) Drupal - Unset (not include) all core stylesheets - Theme variable overrides. - berkes</title>
      <link>https://snipplr.com/view/3756/drupal--unset-not-include-all-core-stylesheets--theme-variable-overrides</link>
      <description>&lt;p&gt;Removes the core, and node styles from the $style variable. &#13;
&#13;
You most morbably already defined _phptemplate_variables($hook, $vars), in that case just add the two lines there.&#13;
_sympal_theme.. is the name of the theme where we use this.&lt;/p&gt;</description>
      <pubDate>Fri, 21 Sep 2007 09:27:05 UTC</pubDate>
      <guid>https://snipplr.com/view/3756/drupal--unset-not-include-all-core-stylesheets--theme-variable-overrides</guid>
    </item>
    <item>
      <title>(PHP) Drupal - Shorten a string - general API - berkes</title>
      <link>https://snipplr.com/view/3647/drupal--shorten-a-string--general-api</link>
      <description>&lt;p&gt;Shortens a string, and adds a span with a title of the full string. &#13;
Function is useful for listings where you don't want wraping; or for places where a long string liek a username can break the layout.&lt;/p&gt;</description>
      <pubDate>Fri, 07 Sep 2007 09:05:02 UTC</pubDate>
      <guid>https://snipplr.com/view/3647/drupal--shorten-a-string--general-api</guid>
    </item>
    <item>
      <title>(PHP) Drupal - Theme table with columstriping - berkes</title>
      <link>https://snipplr.com/view/3607/drupal--theme-table-with-columstriping</link>
      <description>&lt;p&gt;This snipped adds columnstriping to cells. It works fine for most cases, but will behave strange when combined with colspan. &#13;
Cells get an additional class 'even-col'  or 'odd-col'&lt;/p&gt;</description>
      <pubDate>Thu, 30 Aug 2007 11:49:19 UTC</pubDate>
      <guid>https://snipplr.com/view/3607/drupal--theme-table-with-columstriping</guid>
    </item>
    <item>
      <title>(PHP) Put classes around your body - berkes</title>
      <link>https://snipplr.com/view/3423/put-classes-around-your-body</link>
      <description>&lt;p&gt;Put classes around your bodyy, to allow different colors for seperate pages and areas on your site.&#13;
IT will simply add a css-safe version of the first argument in an url. Say the url is /about_us/our_company the class will be&#13;
body.about-us&#13;
Requires phptemplate&lt;/p&gt;</description>
      <pubDate>Mon, 30 Jul 2007 12:48:46 UTC</pubDate>
      <guid>https://snipplr.com/view/3423/put-classes-around-your-body</guid>
    </item>
    <item>
      <title>(PHP) Drupal formalter for a separate teaser field - berkes</title>
      <link>https://snipplr.com/view/2865/drupal-formalter-for-a-separate-teaser-field</link>
      <description>&lt;p&gt;A form alter to gove Drupal a separate teaser field.&lt;/p&gt;</description>
      <pubDate>Thu, 14 Jun 2007 13:12:08 UTC</pubDate>
      <guid>https://snipplr.com/view/2865/drupal-formalter-for-a-separate-teaser-field</guid>
    </item>
    <item>
      <title>(PHP) Form alter to force exposed views filters to fllow filter options - berkes</title>
      <link>https://snipplr.com/view/2674/form-alter-to-force-exposed-views-filters-to-fllow-filter-options</link>
      <description>&lt;p&gt;callback in a form alter to enforce an exposed filter to use only the options set in filter. Works for selectlists only.&lt;/p&gt;</description>
      <pubDate>Sat, 19 May 2007 07:18:22 UTC</pubDate>
      <guid>https://snipplr.com/view/2674/form-alter-to-force-exposed-views-filters-to-fllow-filter-options</guid>
    </item>
    <item>
      <title>(PHP) Per node type flag. - berkes</title>
      <link>https://snipplr.com/view/2436/per-node-type-flag</link>
      <description>&lt;p&gt;A form alter implementation to create variables to flag certain features per node type. E.g. Show foo on blogs only: example_blog == 1;&lt;/p&gt;</description>
      <pubDate>Thu, 05 Apr 2007 12:08:34 UTC</pubDate>
      <guid>https://snipplr.com/view/2436/per-node-type-flag</guid>
    </item>
    <item>
      <title>(PHP) link images to their own node. - berkes</title>
      <link>https://snipplr.com/view/2306/link-images-to-their-own-node</link>
      <description>&lt;p&gt;This snippet is for use with image module, a small contributed module for image handling. (Yes: in Drupal you need a /contributed/ module for this o_O.&#13;
&#13;
The template snippet  links the images to their own node.&lt;/p&gt;</description>
      <pubDate>Mon, 12 Mar 2007 11:30:43 UTC</pubDate>
      <guid>https://snipplr.com/view/2306/link-images-to-their-own-node</guid>
    </item>
    <item>
      <title>(PHP) image_attach theme image in the node - berkes</title>
      <link>https://snipplr.com/view/1796/imageattach-theme-image-in-the-node</link>
      <description>&lt;p&gt;This snippet is for use with image_attach, a small contributed module that uses image module to create nice thumbs in any node type. &#13;
The template snippet makes the images show up larger in the body node, and instead of linking to itself, it links to the attached image node.&lt;/p&gt;</description>
      <pubDate>Wed, 13 Dec 2006 08:03:03 UTC</pubDate>
      <guid>https://snipplr.com/view/1796/imageattach-theme-image-in-the-node</guid>
    </item>
    <item>
      <title>(PHP) Get admin menuID - berkes</title>
      <link>https://snipplr.com/view/1741/get-admin-menuid</link>
      <description>&lt;p&gt;menu_get_item does not return a menu ID.&lt;/p&gt;</description>
      <pubDate>Tue, 28 Nov 2006 11:35:09 UTC</pubDate>
      <guid>https://snipplr.com/view/1741/get-admin-menuid</guid>
    </item>
  </channel>
</rss>
