Blog

Posted by: 
Dominique De Cooman

In this function you can alter existing or give new variables to every theme function.
In this example the theme_page variables are altered. Here we have a product page and this page needs another template file to be loaded. We alter $vars['template_file'] and if the test is true the page-product.tpl.php file will be loaded.
We also create new variables $vars['serviceMenu' and $vars['mainMenu'] which can be used in the page.tpl.php files as $mainMenu and serviceMenu.

<?php
function  _phptemplate_variables($hook, $vars) {
  switch($hook) {
    case 'page' :

Posted by: 
Dominique De Cooman

From drupal.org :
If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings.

Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed posts will automatically use the new permissions.

Posted by: 
Dominique De Cooman

We have build a modules with a lot of strings. We want to translate them. We dont want to search for strings, translate them and submit them using drupals locale interface because it would take hours.
Here is what we'll do. Enable your locale module which is a core module.

Posted by: 
Dominique De Cooman

I have a Mysql table with 2 rows. Total which is the score and uid which is the user id. I want to know which user has what rank. What's the fastest? Let Mysql do the whole sorting job or let Php do it. So I did an experiment. And the results are:

Php did the job in : 0.00024099999999994s
Mysql did the job in : 0.00073499999999993s

Php wins significant!

Posted by: 
Dominique De Cooman

To translate exposed filter labels, go and get the theme_views_display_filters function out of the views.module file. Put it in your template.php file. Make sure that around every label a t function is wrapped. And that's it, go to admin/setting/locale, look up the string and translate it into the other language. (Dont forget to surf one time to the page you want to translate)

Posted by: 
Dominique De Cooman

By creating a file in the root of your drupal folder and put the code on top that we provide in this post.

Posted by: 
Dominique De Cooman

Is this happening to you when you're using the image module trying to submit an image node? Than the problem is probably the workflow module. Those two modules conflict with each other especially when a state is changed from published to unpublished. Turn off your workflow module and you'll see the problem disappear.

Posted by: 
Dominique De Cooman

This makes sure all your content is filtered the way it's supposed to.

Posted by: 
Dominique De Cooman

Go to the location on your server where your file is using cd command

Posted by: 
Dominique De Cooman

Use the old drupal_set_title('') function to set the title and put it in hook_form_alter. Why in a hook_form_alter? If you do it in preprocess page your 're to late, if you want it to do with drupal_set_title(). But what you can do in the preprocess page is set $vars['title'] (thanks to Davy aka the drupalcoder to point this out). Using hook form_alter has the advantage that it's independent of the theme.

Pages

Subscribe to Blog