ComicCMS User Manual

HomeDownloadManualForums

Editing Templates :: Global Variables

You cannot use item specific variables (e.g. {{comic_title}}) in the global templates because they are not linked to any item, they are global. To customize the global templates you can pass global variables to them from your other templates. For for example, if your header template includes: <title>My Comic :: {{title}}</title>

In your comic page template:

If your comic page template set the global variable: title = {{comic_title}} then when viewing the comic page that definition changes to: title = Alice meets Bob This change then shifts to the global templates and replaces the original header code with: <title>My Comic :: Alice meets Bob</title>

Phew, that's a long way around doing it. But wait, here comes the beauty of it.

In your news page template:

If your news page template set the global variable: title = News :: {{news_title}} then when viewing the news page that definition changes to: title = News :: My first news post This change then shifts to the global templates and replaces the original header code with: <title>My Comic :: News :: My first news post</title>

Awesome! And that's all there is to it.

One last thing to note is that global variables are only available inside global templates and will not work within normal templates.

Notice: We're moving on to variable operators now, but remember they don't work in global templates. So if you want to send formatted text to the header you have to add those operators into the global variable defintion in the template, e.g: blurb = {{comic_blurb:rich}}

ComicCMS, free php webcomic management software Copyright © 2007 Steve H