Archive for September, 2010

 

Magento – Add custom content layouts for CMS pages

1

Magento

Sometimes in the main content block of your theme, the design requires to have a complicated CMS page content layout that stray from using basic linear content (Adding blocks below whatever is under the main content block). You may want various blocks to be set anywhere you want EG the homepage..

This post shows a good clean way to use the layout XML and PPH in your layout files to position blocks of content exactly where you want inside your main content block.
(more…)

 

Drupal CSS aggregator

0

A couple of pointers when you’re getting into theming Drupal the correct way rather than just hacking around as is most fun.

I seem to hit troubles getting the aggregator feature of Drupal working, and often end up just slapping an external CSS link call in to the page template.

The proper way to do is a little long winded, but gives us the speed optimisations offered by the aggregator facility. Instead of putting <link … /> in the page.tpl.php file, use the drupal_add_css() function in your template.php file.

The best place to put it is in a function called <themename>_preprocess_page().

And here’s an example of what that function can contain…

function mytheme_preprocess_page(&$vars) {
  //JA Inject theme styles and js
  $resetcss = drupal_get_path('theme', 'mytheme') . '/yui/build/reset-fonts-grids/reset-fonts-grids.css';
  $thickboxcss = 'misc/thickbox/thickbox.css';
  $thickboxjs = 'misc/thickbox/thickbox-compressed.js';

  drupal_add_css($resetcss, 'module', 'all', 1);
  drupal_add_css($thickboxcss, 'theme', 'all', 1);
  drupal_add_js($thickboxjs, 'theme', 'header');

  $css = drupal_add_css();
  $vars['styles'] = drupal_get_css($css);
  $vars['scripts'] = drupal_get_js();
}

Some other things to watch out for .. make sure the path you provide the aggregator is relative from root but not relative to root… I’m not helping much am I!
I mean this …
misc/thickbox/thickbox.css
as oppossed to this …
/misc/thickbox/thickbox.css

Also make sure the web server has access to the files .. correct permissions etc.
I found that even pointing the aggregator at symlinks instead of the actual files was causing a problem .. probably to do with permissions on the real files.

Anyways .. hope that helps!

References:

http://api.drupal.org/api/function/drupal_get_css/6

http://api.drupal.org/api/function/drupal_add_js/6

 

NVIDIA and suspend issues

0

I’ve got the nvidia proprietary video drivers running on my Fedora laptop using the rpmfusion-nonfree yum repo.

I also installed the akmod-nvidia package as it recompiles the kernel module for the graphics each time a new kernel is installed. Super!

However I’ve been battling with power suspend failing when slamming the lid on my laptop.. it hangs and won’t power off/restart without a nasty 10 sec power button press and hold.
I think I’ve finally figured the problem. It seems the kmod-nvidia- tries to install as well.

A bit of the following and all seems well in sleep world!

yum remove kmod-nvidia-

In /etc/yum.repos.d/rpmfusion-nonfree-updates.repo add this line beneath the [rpmfusion-nonfree-updates] block

exclude=kmod-nvidia-*
Go to Top