A theme is a set of files and database info that gives a Grawlix site its unique look and feel.
HTML. CSS. PHP. MySQL. Long ago, all you needed as the first — maaaaybe the second — to build a web page. All that changed as websites became complicated publishing platforms. Grawlix is no exception.
The HTML for every page in a Grawlix website, from its home to the FAQ to a comic page to the archives, comes from a set of scripts collectively called a “theme.” While your site might have several themes installed, it only runs one theme at a time.
Most theme scripts are named for what they do.
page.archive.php, for example, generates HTML for the archive page. Likewise
page.comic.php generates HTML for comic pages, and
page.static.php generates HTML for static pages.
Customizing your site’s HTML
To edit a theme’s HTML, you need to edit its PHP scripts. There are two types of those.
Page scripts begin with the word “page,” like
page.comic.php. These are the main files that comprise the different types of pages on your site — specifically, the comic pages, static pages and archive page.
Snippets begin with the word “snippet,” like
snippet.header.php. Snippets are bits of code that Grawlix adds to page scripts where appropriate. They’re useful for HTML that will get used throughout a site, like the header and footer. Take the header snippet, which contains the HTML
<head> and opening
<body> elements. Every page script would stick that snippet’s code right at the top of the page.
So you know some code, do ya?
To seriously edit Grawlix themes, you need a working knowledge of HTML, CSS, and PHP. Familiarity with Foundation, the framework on which the Grawlix CMS’s default themes are built, wouldn’t hurt either.
For example, let’s say you have 50 pages in your comic. Heck, make it 100. When a reader wants to read one of them, Grawlix figures out what page number they’re on, and uses
page.comic.php as a template for the web page that the reader will see. Grawlix adds the appropriate comic image, blog post and transcript; it loads ads, if necessary; it grabs the header and footer styles.
It works because in Grawlix themes, each PHP script contains a bit of the whole HTML file that readers’ browsers display. The header script holds the beginning, the footer holds the end, and other scripts handle the middle. Grawlix strings ’em all together every time a reader visits a page.
Your readers don’t know any of that. You don’t need to, either, usually. It only comes up if you want to edit your site’s theme.
You can add a snippet to a page script with a bit of PHP code.
<?=snippet('name')?> is a function that includes a template file from your theme. The text in quotes matches part of a filename. For example,
header corresponds to
Indotherm, Grawlix’s default theme, uses:
These files must use the
.php extension, but they don’t have to contain any PHP. A bit of plain HTML is fine. Also, you can create your own snippets. Just create a file called
snippet.your-custom-name.php, then add it to a page script with
<?=show('item')?> is a function that displays predefined items which usually come from the database. The text in quotes corresponds to a label used by Grawlix. For example,
<?=show('date_publish')?> will show readers the publication date of the comic page they’re reading.
For a list of the predefined items, read more about the show() function
Ads work almost the same way.
<?=show_ad('label')?> is a function that displays ads from services you’ve setup in the admin panel. The difference between
show_ad() is that for
show_ad('x'), the label in quotes matches the label used by Grawlix to define that specific ad slot.