Alex's blog

Update to Drupal 7

Submitted by Alex on Mon, 02/14/2011 - 15:21

Finally i updated my blog to Drupal 7 from Drupal 6.20. Wasn't hard at all, but still requires some skills and understanding of Drupal internals. Also site theme is now changed to Sky which is a nice CSS3 + HTML 5 powered theme implementing 960gs framework.

Problem with Eclipse PHP project

Submitted by Alex on Tue, 06/29/2010 - 15:37

Symptoms:
1. XDebug is not working
2. Code completion is not working
3. "Go-to definition" is not working (CTRL+Click on function name)
4. Eclipse do not see your PHP errors

Usually this means that Eclipse do not know that your project is PHP type, sometimes it happens when you create a project via checkout from SVN. So, what to do:
1. Create new PHP project and save it. Check if everything working with the new project.
2. Check .project file in the root of the new project directory you just created. You should see something like this:

HTTP error 0 in apachesolr_autocomplete

Submitted by Alex on Mon, 06/21/2010 - 11:04

If you didn't know it before - there is a nice module which will provide autocomplete functionality to all of the search forms on your Drupal site. Recently i have installed this module on our development box and everything was pretty fine. Today i pushed a new version of the site to the preproduction box and autocomplete stops working with errors:

PHP Fatal error: Uncaught exception 'Exception' with message '"0" Status: Request failed' in /sites/all/modules/apachesolr/Drupal_Apache_Solr_Service.php:272
Stack trace:

Function path_to_theme() can catch you

Submitted by Alex on Tue, 03/30/2010 - 14:53

Return the path to the current themed element.
The main thing is that if you will call it from the module preprocess hook - it will return the
path to the module.

So if you want to keep your logic in code and still be able to help your designer/js-coder (who doesn't know for sure where is the custom module files, but know the theming a bit):

drupal_add_js(drupal_get_path('theme', variable_get('theme_default', 'garland')) ."/js/cooljavacriptfilehere.js");

From api.drupal.org:

Managing comments access on the fly

Submitted by Alex on Tue, 03/23/2010 - 10:54

As you may already know, you can control the comments module behavior with user permissions and with per node-type settings. But what if you want to change the node comments access on the fly?

The problem:
On some nodes i want to disable the comment form for current user, but show him the comments. It is possible with the default comment settings of this node type or with access permissions. But what if the permissions are configured for full read-write access for the current type of node and current user have permission to post comments?

Solution:

Pages

Subscribe to RSS - Alex's blog