Page 1 of 1

How to make your own PCM style

PostPosted: 01 Aug 2006, 15:44
by Andrew
Chapter 1: Setting up your style



Pro Clan Manager uses the smarty template system to separate html content and PHP. The smarty template system can be found here http://smarty.php.net .



To begin working on your own style for Pro Clan Manager first:



1) Make a copy of the ?default? folder in the ?theme? directory.

2) Rename the folder you just copied to a unqiue name you wish your new style to be. For best compatibility please make sure the folder name has no spaces in it.



You now have a new style, almost. The style you have now created is an exact copy of the default style, but you do not want your style to be called "default" so lets change that. First:



1) Go into your new style folder

2) Open up the file index.php in a text editor



Now you will see the follow text.



$style_name='Default';

$style_description = 'Default style by Andrew Fenn.';



The first line tells Pro Clan Manager what your style?s name is. The second line is your style?s description.



You will want to change these lines so that you will be able to know which style is yours when installing or changing styles, etc.



Chapter 2: Installing your style for testing



You now should have your own style with its own name and description. Now you will want to install your style into Pro Clan Manager so that you can start editing and testing your theme.



1) Log in to your website

2) Go to the admin section

3) You should be able to see your style?s name and description, click on the install link.

4) Click on the selection box and select your style from the list.



Pro Clan Manager is now using your style to display the website.







Chapter 3: Editing your website



If you open up your style?s folder you will notice that there are many different files. The files are broken down into different sections so that anything to do with for example the polls section is placed into polls.tpl



Here is a list of all the different files and what you will find inside them:



- admin.tpl - The admin section and editing emails.

- control_panel.tpl - The control panel section with all the icons to different parts of the website.

- events.tpl - The events section, adding, editing, etc.

- files.tpl - The downloads section, adding, editing, etc and making folders in the download section.

- gallery.tpl - The screenshots section, adding, editing, etc and making folders in the screenshots section.

- main.tpl - This template holds the contents of your web site?s layout. You should put the header and footer of your website in here.

- modules.tpl - The modules section, disabling modules, installing new modules, etc.

- news.tpl - The news section adding, editing, etc and it also holds the html that is should on the main page news.

- poll.tpl - The poll section adding, editing, voting and viewing polls.

- rank.tpl - The rank section adding, editing and deleting ranks.

- user.tpl - This template holds the user listing section, user biography section, changing passwords, editing users accounts, etc.





When editing these files you will come across words in brackets such as {$example}. This is a Smarty variable which is used to put dynamic content into the website. There are numerous variables that you can use all over the website. Some variables are global (they can be used on any page) others are local (can only be used in specific pages or sections of your site).



Here is a list of all the different variables that Pro Clan Manager uses:



Global Variables (can be used anywhere on the site)



Variables that can be used when a user is logged in


{$g_menu_private} - The private menu list where only logged in users can see

{$g_user_id} - Gives you the users id number

{$g_user_member} - If ?true? then the user is logged into the website. Otherwise it is empty (NULL).



Variables that do not matter if the user is logged in

{$g_menu_public} - The public menu list there everyone can see

{$g_modules} - A list of all the modules installed on the site along with their status

{$g_site_chat} - Contains a list of all the text in the websites chat.

{$g_site_config} - Contains a list of all the websites variables.

{$g_theme_dir} - Contains the folder name of your style. For example "theme/{$g_theme_dir}/images" would render "theme/default/images".

{$g_user} - Contains information about the user that is currently logged into the website.

{$g_content_area} - This variable contains everything that is in the main content area. This variable should go between your header and footer.



Local Variables (can only be used in specific places)



Variables that can be used when a user is logged in




Variables that do not matter if the user is logged in



{$m_news_headline} - index.php - Lists a number of news headlines.

{$m_news_list.news} - news.php - Lists all the news posts.

{$m_news_list.page} - news.php - Shows the total number of pages needed to display the whole news list. Example 20 news posts with 15 news posts per page would mean that you would need 1 extra page in total.

{$m_news_archive} - news.php?news=1 - Shows the news post information you have clicked on.

{$m_user_list} - users.php - Shows a list of all the users.



-- Listing of all the variables is still in progress --



Variables are not the only thing that the templates can do. You can also use Smarty functions in your templates as well as if statements, time functions, formatting functions, etc.



Go to http://smarty.php.net/manual/en/ to get more information on how to use Smarty.



From time to time you will also see comments in the templates that look like this:



{* some comment *}



This type of comment will not show up in your web page.



Chapter 4 - Final comments



Some times your screen might go blank, or tell you something about a Smarty error. This is because you have typed something wrong in your template to do with a Smarty variable.



Common problems are not including {/if} at the end of your Smarty if statement or forgetting to use the "$" dollar character for a variable {badexample} should be {$goodexample}.



You can not use the characters "{" and "}" in the templates without first using the {literal} {/literal} tags in smarty first. If you try to do some Javascript for example without first using these tags then you will get a smarty error.



Please put the "Powered by Pro Clan Manager" link somewhere in your template. I do not care about how big, where the link is, how it looks like, etc. As long as there is some kind of reference back to this site where others can download and use PCM too.



I will not offer any support to people that do not offer support to this project.



If you find any problems with this guide reply to this topic and I will correct them. If there is anything you would like to add also please reply.