Hi can someone help me in adding a body ID to the html. Like "body id="pid-home" class="html front not-logged-in no-sidebars " . So when views the pages the body tag will have the URl alias added as ID. This works by Default in Fusion. But would be great if Omega could add this.

Thanks

Comments

JSCSJSCS’s picture

If you are using the context module, it is fairly straight forward:

http://drupaleasy.com/quicktips/using-context-module-set-body-classes

Otherwise, you will need to code it in the template file, separate module or modify the .tpl files.

chrisjlee’s picture

Also, if you're using context it may just be easier to load your files based on the page with context add assets rather than hard coding a body id:

http://drupal.org/project/context_addassets/

vishusrinivasan’s picture

This might help:
1. Copy the html.tpl.php from the omega core templates folder to templates folder of your subtheme.
2. Edit the html.tpl.php and add ID like below for the body tag
<body<?php print $attributes;?> id="<?php print $body_id; ?>">
3. Create preprocess-html.inc in the preprocess folder of your subtheme and add the following code and clear the cache.

<?php
function YOURSUBTHEME_alpha_preprocess_html(&$vars) {
$vars['body_id'] = 'pid-' . drupal_clean_css_identifier(drupal_get_path_alias($_GET['q']));
}
?>

Hope it helps.

rohith122’s picture

thanks for your replies. @vishusrinivasan, that worked perfectly thanks

chrisjlee’s picture

Status: Active » Closed (fixed)
chrisjlee’s picture

Issue summary: View changes

removed html tags from message