drupal recipe

How to make stylesheet refresh automatically

Categories:

When I build a site, I always make changes to the style.css file. I always add, modify or remove styles, but there was a problem. When someone came to see my site they would see an old version of the site because their browser would cache the style.css file. In order to avoid this, I came up with this drupal recipe or theme snippet.

PREV NEXT links for nodes in circular way

Categories:

This is just a sample of how you can add PREV NEXT links to your node type template. This function generates links to navigate your nodes in alphabetical order ASC.

How to create a custom search box

Categories:

This is an example on how you can create a custom search box for your drupal site. The code below renders a text box and a button. When you perform a search, drupal will only look for the keyword inside the node types specified below (page, recipe, product, blog_article).

You can just copy and paste this code into a block.

Collapsible fieldsets

Categories:
Code snippet to build collapsible fieldset like this one:

Block visibility php snippets

Categories:

Display a block on certain pages by url and by node type.

How to remove the "My account" link

Categories:

This php snippet is useful for customizing the behavior of the "My account" link. Sometimes you want to place a login link in one of the menus. It might be confusing sometimes because after you login, the link won't show as "Logout" but as "My account". This is not ideal so you can use the snippet to make it show as "Logout".

Place this code inside your template.php file.

Webform form insert

Categories:

Php snippet to insert a webform in any node.

.htaccess drupal redirection

Categories:

.htaccess code snippet to have any url to redirect to another url. You would insert this in your .htaccess file. This is very useful when you are migrating a static html site into a Drupal site.

Generate a CSV file

Categories:

Snippet to generate a CSV (comma separated values) file from any table or combination of tables from the data base.

Access content denied for anonymous user

Categories:

I have come across this issue many times now. It started to appear in Drupal 5.x . The reason is not completely clear to me but some say that it has something to do with the tac_lite module. It seems that when you enable this module and then you disable it, it won't properly restore the node_access table in the database. It won't create the default node_access row. To fix it, just run the following query:

Syndicate content