Theme Variables

Like common theme, HTMLy have many variable.

Note: you should compare it with the latest theme included with the package.

layout.html.php

This file contain the main layout for your theme.

<!DOCTYPE html>
<html>
<head>
    <?php echo head_contents(); ?>
    <title><?php echo $title; ?></title>
    <meta name="description" content="<?php echo $description; ?>"/>
    <link rel="canonical" href="<?php echo $canonical; ?>" />
    <link rel="stylesheet" type="text/css" href="<?php echo theme_path();?>css/style.css">
</head>
<body>
<?php if (facebook()) { echo facebook(); } ?>
<?php if (login()) { toolbar(); } ?>
    <div class="header">
      <h1 class="blog-title"><a href="<?php echo site_url();?>"><?php echo blog_title();?></a></h1>
    <div>
    <div class="wrapper">
        <div class="main-content">
            <?php echo content(); ?>
        </div>
        <div class="sidebar">
            <div class="search">
                <?php echo search(); ?>
            </div
        </div>
    </div>
    <div class="footer">
        <?php echo copyright() ?>
    </div>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
</body>
</html>

layout.html.php variable

Some of the variable below usually used on layout.html.php but can be used on any template file.

Print out meta charset, viewport, sitemap, and RSS etc.

head_contents()

Print out the page title, meta description and canonical link.

$title
$description
$canonical

The site/blog url

site_url()

The facebook script if we use Facebook comment

facebook()

Login or not?

login()

The toolbar

toolbar()

Is this index page?

is_index()

Blog title, tagline, description

blog_title()
blog_tagline()
blog_description()

The main content

// This displayed the content from other 
// template file like main.html.php, post.html.php 

content()

Copyright notice and credit link

copyright()

Google anaytics

analytics()

main.html.php

This template file handle posts index like on dynamic frontpage, tags, categories, archive and search result.

main.html.php variable

Below is the most important variable for main.html.php since it contains post collections.

$posts

We need to do foreach to extract it.

<?php foreach ($posts as $p): ?>

<?php endforeach;?>

Available variable inside the foreach

$p->url
$p->title
$p->date
$p->body
$p->description
$p->tag
$p->category
$p->author
$p->authorUrl
$p->related
$p->views
$p->type
$p->file
$p->image
$p->video
$p->audio
$p->quote
$p->link
$p->readTime
$p->lastMod

Print out the teaser inside foreach

get_teaser($p->body, $p->url)

The category info

$category->title
$category->url
$category->md
$category->slug
$category->description
$category->body
$category->file

Tags title, archive title, search title (helper) has similar var

$tag->title
$tag->url
$tag->description

Breadcrumb

$breadcrumb

The pagination

$pagination['prev']
$pagination['next']
$page
$pagination['pagenum']

To render complete pagination

$pagination['html']

Disqus comment count

disqus_count()

post.html.php

This is for single post and the available variable is like on main.html.php:

$post->url
$post->title
$post->date
$post->body
$post->description
$post->tag
$post->category
$post->author
$post->authorUrl
$post->related
$post->views
$post->type
$post->file
$post->image
$post->video
$post->audio
$post->quote
$post->link
$post->readTime
$post->lastMod

Breadcrumb

$breadcrumb

Disqus comment

disqus($p->title, $p->url)

Disqus comment count

disqus_count()

Post navigation

$prev
$next

The $prev and $next variable also has all variable like on $post. Eg.

$prev['url']
$prev['image']

Related posts

get_related($p->related)

static.html.php

Below is the common variable for static.html.php

$static->title
$static->url
$static->views
$static->file
$static->md
$static->readTime
$static->lastMod
$static->description
$static->body

For subpages has additional var $static->parent and $static->parentSlug

profile.html.php

The profile page variable.

The $posts variable is like on main.html.php

$author->name
$author->about
$author->slug
$author->title
$posts

Other template file

Mostly only contains HTML tags. Or print the search widget:

search()