Monday, October 27, 2014

Drupal - Rebuild permissions

Because I always forget where to find the rebuild permissions button in Drupal, this is my reminder

drupal 6   /admin/content/node-settings/rebuild
drupal 7   /admin/reports/status/rebuild

I actually do not have permission to use this image....

Thursday, October 16, 2014

Drupal 7 - apache solr - how to add an total results count to your results

Somehow I naturally expected a total results entry somewhere in the arrays solr sends me, but I could not find it.
So, what is so weird about wanting to show the number of results?

The solution is of course rather simple, like everything is simple in hindsight, but nevertheless it took me hours to come up with it. Mostly because I was googling through endless hits more or less about this problem and maybe I should try to catch some more sleep....

The solution is to lift the value from the GLOBALS array.  Add  $GLOBALS['pager_total_items'][0] somewhere to a variable in a preprocess hook or simply print in in your template file like thus:

<div class="counter"><?php print $GLOBALS['pager_total_items'][0].' results'; ?></div>