+ Live Sales Chat  |  Call Us: 1-888-227-5040   |   Contact Support     
Login

Using Smarty Templates in KnowledgeBuilder

Posted by: Chris    In: General

4 Aug 2005

## KnowledgeBuilder Template Structure ##
When you visit the front page of your [KnowledgeBuilder][1] site you are in the *startup* context. KB loads up the *index.htm* template which in turn (because you’re in the *startup* context) loads *startup.htm* for the internal section. Remember, *index.htm* the the container template for all the pages on your site (with a couple exceptions). This structure can’t be changed, the `index.htm` template is always used first and it is responsible for:

1. Drawing the “frame” of the website
2. Including a *context specific* template, specified in a the [Smarty][2] variable `$content_template`

In the *Default* template set’s `index.htm` line 238 looks like this:
[html num=238]
{ include file=$content_template }

[/html]

Notice the `{ include file=$content_template }`? Thats a [Smarty][2] [*include*][3] statement, the `$content_template` is a variable that holds the name of the content-specific template for whatever context the site is currently in. For example, when viewing an article, `$content_template` has the value `article.htm`, and so line 239 in `index.htm` brings in the contents of the `article.htm` template. Likewise, when looking at a category, the `$content_template` variable has the value `category.htm` and so the contents of the `category.htm` template are brought in. This allows you to maintain a consistant *shell* around the contents of your site.

This structure is about the only one you must keep when designing your own template sets: A central `index.htm` template and various *context specific* templates with the proper names. For reference, here’s a list of the *context* template names:

* category.htm – Used to show the view of a category
* email.htm – Used when emailing an article to someone
* comment.htm – Used when viewing all comments or making a new comment
* article.htm – Used to show a single article
* saved.htm – Used to show/manage your saved articles
* author.htm – Used to view author information about an article
* glossary.htm – Used to show the Glossary terms
* search.htm – Used to show the search page
* similar.htm – Used to show similar articles
* contact.htm – Used to allow the user to ask a question
* login.htm – Used to login for locked content or categories
* startup.htm – Main startup page

*Continue to the next page to get the basics on how to use Smarty markup…*

[1]: http://www.activecampaign.com/kb “KnowledgeBuilder”
[2]: http://smarty.php.net “Smarty”
[3]: http://smarty.php.net/manual/en/language.function.include.php “Smarty Include Function”

Pages: 1 2 3 4

Related posts

4 Responses to Using Smarty Templates in KnowledgeBuilder

Avatar

Tim

August 4th, 2005 at 12:34 pm

Very nice write up. The {Debug} is great tool – I wish I had known about this earlier.

tb

Avatar

Chris

August 4th, 2005 at 12:42 pm

Yeah, {debug} is your best friend when working on a Smarty based site.

Avatar

Make Your Own Web Site » Make Your Own Web Site

April 3rd, 2008 at 5:24 pm

Make Your Own Web Site » Make Your Own Web Site…

As a final bid for bringing together community through the library a calendaring system could be implemented which gives all recognized community organizations an opportunity to plug into a central calendar system, hosted by the library; providing a li…

Avatar

Create My Business Plan

October 30th, 2008 at 3:21 am

Smarty Template Engine is really work smartly….i am appreciating it from core.Thanks!!

Comment Form

Subscribe By Email
Receive email alerts when new blog posts are available!


© 2010 ActiveCampaign,Inc. All rights reserved.