Phoocs (PHP + OOCSS)

Hides the complexity, reveals the simplicity

"Phoocs" comes from PHP + OOCSS. It is a very lightweight framework that wraps two of the coolest features of OOCSS -- templates and modules -- into three simple, clean, object-oriented PHP classes.

Source code for this page

Sample pages

These sample pages are built on Phoocs.

They are based on pages found at OOCSS.org

Phoocs on GitHub

Phoocs is available on GitHub at github.com/mmapes/PHOOCS

Modules

OOCSS modules require you to buy in to some fairly complex and specific HTML structures. You don't want to memorize those structures; you just want to specify what goes in the head, body, and foot of your current module. PHOOCS hides the complexity and reveals the simplicity.

Here is an OOCSS module written in HTML:

<div class="mod grab">
	<b class="top"><b class="tl"></b><b class="tr"></b></b>
	<div class="inner">
		<div class="hd">
			<h3>grab</h3>
		</div>
		<div class="bd">
			<p>Body</p>
		</div>
	</div>
	<b class="bottom"><b class="bl"></b><b class="br"></b></b> 
</div>

Here is an OOCSS module written in PHPOOCSS:

$grab = new Module("<h3>grab</h3>", "<p>Body</p>", "grab")

Templates

OOCSS templates aren't quite as complex as modules, but they do require a specific HTML structure that gets repeated on every page of your site. With PHOOCS you just add content (HTML or modules) to the head, foot, left column, right column, or center column. And while you're at it, add your repeated disclaimers, meta tags, and script tags, too.

Here is how you would add the "grab" module (from above) to your left column:

$page = new Page();
$page->addToLeftCol($grab);

Other conventions

We could add support for other OOCSS conventions like lines and units, but those are already relatively simple and do not benefit as much from PHP suport.