About Body class

A ProcessWire module to add some classes to your body tag. That will give you a better control of your CSS.

Category Other Modules
Modules that have a unique purpose not covered by existing categories.
Release StateStable
Should be safe for use in production environments. *
Authoryesjoar
Module Version1.0.0
Class NameBodyClass
Compatibility2.2
Date AddedNovember 11, 2012
Recommended ByNew recommendations may take up to 1 day to appear.

Details

Basic usage
Add this code into the class of your body tag:

Code:
<?php echo $modules->get("BodyClass")->bodyclass() ?>
So your body tag should look like this:
Code:
<body class="<?php echo $modules->get("BodyClass")->bodyclass() ?>">

Custom usage
Code:
<?php echo $modules->get("BodyClass")->bodyclass(array('page_id' => false, 'template_name_prefix' => 'templatename-')) ?>

Default options
Code:
array( 'page_id' => true, // bool (default true) return the page id 'page_id_prefix' => 'page-id-', // string (default 'page-id-') prefix for page_id 'parent_page_id' => true, // bool (default true) return the page id of of parents 'parent_page_id_prefix' => 'parent-page-id-', // string (default 'parent-page-id-') prefix for parent_page_id 'template_name' => true, // bool (default true) return the template name 'template_name_prefix' => 'template-', // string (default 'template-') prefix for template_name 'browser_info' => true // bool (default true) return some browser informations (os, browser, browserversion) );

Instructions

This module's files should be placed in /site/modules/BodyClass/
How to install or uninstall modules

README

BodyClass for ProcessWire

Description


A ProcessWire module to add some classes to your body tag. That will give you a better control of your CSS.

Basic usage


Add this code into the class of your body tag:

<?php echo $modules->get("BodyClass")->bodyclass() ?>

So your body tag should look like this:

<body class="<?php echo $modules->get("BodyClass")->bodyclass() ?>">

Custom usage


<?php echo $modules->get("BodyClass")->bodyclass(array('page_id' => false, 'template_name_prefix' => 'templatename-')) ?>

Default options


array(
	'page_id' => true,
	// bool (default true) return the page id
	
	'page_id_prefix' => 'page-id-',
	// string (default 'page-id-') prefix for page_id
	
	'parent_page_id' => true,
	// bool (default true) return the page id of of parents
	
	'parent_page_id_prefix' => 'parent-page-id-',
	// string (default 'parent-page-id-') prefix for parent_page_id
	
	'template_name' => true,
	// bool (default true) return the template name
	
	'template_name_prefix' => 'template-',
	// string (default 'template-') prefix for template_name
	
	'browser_info' => true
	// bool (default true) return some browser informations (os, browser, browserversion)
);

Installation


  1. Copy the BodyClass.module file into site/modules
  2. In the admin interface, navigate to the modules page and hit the “Check for new modules” button
  3. Click on “BodyClass” in the new module message or scroll down until you locate it
  4. Click the “Install” button