Developing Themes for Havalite

HavaLite CMS

A new liteweight Content Management System (CMS)

Developing Themes for Havalite

How to develope themes for Havalite CMS

Before Begining

The best way to create own Theme Design for Havalite is to check existing layouts. Here we have a couple of simple layouts just to see clearly the most important php commands and the rest is done in the css file, which is much important for you as a css developer.

The name of your template is simply the name of the folder, where all files exist. So its up to you whether you make the whole template in only 1 file or split in many files, such as in our layouts. Most important is the index.php file which must be contained in your template folder. Also a small *.png image (180x150) which has the same name as your folder should be included in it. This is very useful for the user by choosing a template in his settings.

Own, Offered or Widgets Functions

Of course you can do your own connection to the database and retrieve what ever you need but we have also a plenty of functions that can be used for easier and faster developing besides you can offer the ability to the user to design his own sidebars by impementing widgets. You can use of of the 3 ways or all together. The following table shows the most important functions which used for creating themes:

Theme Functions

hava_all_queries($sql, $data = array); Get values from the database by sending sql command and retrieve an array as result;

$result = hava_all_queries('SELECT * FROM posts WHERE id=?', array(1, 3));

hava_single_query($sql, $data, $col=''); Returns the first founded row.
If $col is set, returns the value:

echo hava_single_query("SELECT * FROM cat WHERE id=?", 5, 'name');

hava_num_rows($SQL, $data = array()) Retrieve the amount of rows for any table

hava_num_rows("SELECT * FROM images WHERE images_cat = ?" array('2011'));
saveSqlite($SQL, $data, $insert=false);

Save single query to db.
$data = must be array
$insert => set true to retrieve the last inserted id

saveSqlite("INSERT INTO posts (title, text) VALUES (?, ?)", array("New post", "The text of the new post"), true);  // this will insert a new post and returns the last id

Options

 

hava_options($opt);

Retrieve the value of a single option from Table "options"
$opt = one of the following properties:
  • url   // url of the site
  • title   // title of your blog
  • tagline   // tagline of your blog
  • description   // description of your homepage
  • language   // interface language in the admin area
  • theme   // theme used
  • thumbnail   // size of the thumbnail for images
  • limit_res   // how many posts or images to be viewed
  • page_cat   // which categrory should be for static pages
  • date_time   // date format
  • noteEmail   // on/off - get messages by new comments
  • editorHeight   // The height of CKEditor
  • filterMax   // use GD filters for images that have max height (e.g. 600)
  • post_amount   // the number of posts to be viewed
  • notes   // Sticky Notes text
  • editorConfig   // configuration of the CKEditor
  • yearMonthCat   // on/off - images category get a name according to Year/Month
  • frontPage   // latest post or static page
  • editorStyles   // additional styles which appears in CKEditor styles
  • usersBoard    // whether text or html
  • usersLvl   // Admin can define 5 different levels for registrated persons
  • mobile   // yes/no - change to mobile style if the template got one
  • add_styles   // to differentiate between registered users who write in the dashboard, every name can have his own style (#brd_admin = the style of the admin)
  • error_page   // insert some Text to view when visitors get error page
  • widgets   // name of all widgets, in which sidebar, whether active or not
  • backup   // standard or zipped
  • similar_post   // on/off - views keywords of the current post with a search link for every word
hava_options('url');
hava_date($myDate, $formate='') get date formate as set bei the user
  • $myDate   // set the date (2012-08-14 20:30)
  • $formate   // define own formate or leave empty

hava_date('2012-08-14', 'd.M.y');

hava_template_url(); Retrieve the path of the template folder url

Comments

 
hava_comments($postId);

 

Returns all comments to the specified post id
hava_comments(3);
save_comment($postId, $name, $email, $comment, $website=''); Saving comments to database: Returns 1=success or 0=Failed
  • $postId   // comment is written to post with the id ?
  • $name   // name of the subscriber
  • $email   // his email
  • $comment   // and his comment
  • $website   // his website if exists

save_comment(3, 'guest', 'guest@web.com', 'My comment to this post is ...', 'http://myhomepage.com');

hava_num_comments($id); Returns amount of comments
  • $id   // the post id

hava_num_comments(3);

hava_comment_form($p, $name='', $email='', $website='', $comment='', $submit=''); View a comment form. All variables except $p are the translation or another text
  • $p   // the post id
  • $name
  • $email
  • $website
  • $comment
  • $submit

hava_comment_form(3);

validate($email); Validating email. The function is also used by save_comment();

validate('myemail@web.com');
hava_gravatar($email); Gravatar image according to mail adresse

hava_gravatar('myemail@web.com');
correctUrl($url) Check if url has -> http:// . If not, return the right methode

correctUrl('www.myurl.com');

Posts

 
hava_single_post($id, $dataName, $slice='0'); Get a single post
  • $id   // the post id
  • $dataName   // the column name from the table "posts": (title, cat, author, tags, text, date, prop)
  • $slice   // slice the post text
    (0 or leave empty = all text)
    (1 to any number = the first x chars)
hava_single_post(14, 'text', 300);
hava_date($myDate, $formate=""); View date as set in the admin setting:
  • $myDate = the date retrieved from the database
  • $formate = leave empty or change ((d/m/Y), (d.M.y, H:i) etc...)

hava_date('2012-08-14 16:20', 'd.M.y, H:i');

Sidebar

 
hava_sidebar_pages($writtenBy='', $element='', $sort = 'sort'); Show static pages in sidebar
  • $writtenBy   // change the phrase "written by:"
  • $element   // id or class
  • $sort   // sort page titles according to => sort, id, date

hava_sidebar_pages('by: ', 'class="mypagesClass"', 'sort');

hava_sidebar_posts($limit=''); a number of latest posts to show in sidebar
  • $limit   // how many posts to show

hava_sidebar_posts(12);

hava_sidebar_cat($element='', $post=false, $menu = false); a number of categories to show in sidebar
  • $element   // id or class
  • $post   // true/false, show post amount of this category
  • $menu   // true/false, show select menu or in UL tag

hava_sidebar_cat('class="myCatClass"', true, false);

hava_sidebar_comments($limit='', $written_by=''); a number of comments to show in sidebar
  • $limit   // how many
  • $writtenBy   // change the text "Wriiten by:"

hava_sidebar_comments(12, 'author: ');

hava_sidebar_links($element=''); View links in <ul><li> Tags
  • $element   // define id or class

hava_sidebar_links('class="mylinks"');

hava_sidebar_search($input='Search', $submit ='Submit', $img=''); View a search form
  • $input   // the value of the input
  • $submit   // the value of the submit button
  • $img   // image instead of the submit burron - define the url

hava_sidebar_search('...', 'OK', '');

smiley($msg); View date as set in the admin setting:
  • $msg   // the text to change

smiley('a smiley looks better :) than pure text');

Widgets

 
hava_sidebar_widget($sidebar); Retrieve one sidebar by name:
  • $sidebar   // The name of the sidebar

hava_sidebar_widget('sidebar1');

   

 

comments powered by Disqus

3 Comments

  1. Written by: Abdillah SIregar
    on 04.Jun.2015
    Hi
    how can i use it? for joomla or wordpress?
  2. Written by: Libra Yanada
    on 10.Jun.2015
    Very nice, thanks :)
  3. Written by: admin
    on 18.Jun.2015
    These themes are made for Havalite CMS only

Leave a Reply

Contact Info

Phone: +49 941 26175

Address: Ayman Teryaki,
Prüfeninger Str. 48,
93047 Regensburg, Germany

Want more info - go to our contact page or visit Google+

Social

Stay up to date. Subscribe via RSS, Facebook, Twitter or Email

Recent Comments