CComment docs

#

Creating a new template

The templates in CComment5 have a specific structure. So instead of starting a new template from scratch we advise you to copy an existing template and make modifications to it (you can still give it a different name and it won't act as a template override, but as a different template).

Let us create a new template step by step.

  • Go to components/com_comment/templates . Copy the default template

  • Paste the default template in templates/your_joomla_template/html/com_comment/templates

  • Rename the default folder to mytemplate (mytemplate = the name you wish to give to your new template)

Now when you go to your joomla backend -> components -> ccomment -> Settings -> your component settings -> in the template tab you should be able to select the template that you just created.

Table Structure of a CCommet5 template

default.php This file loads the css & javascript and the necessary template for the javascript of the component to work. You are not advised to change any html ids in here. What you can do and you should do in this file is to change the path to the css file and add any necessary scripts in here.
settings.xml This file contains the settings that are available in the backend of the component (in the template tab). You should not modify any of the default settings, but you are free to add your own settings (for example if you distribute this ccomment5 template with your own joomla template & you want to give some special features to your users). This file follows the JForm xml structure.
default_comment.php This file contains the structure of each individual comment. You should not change any html ids or classes as this can lead to the malfunctioning of the component. On the other hand you are free to add your own classes to any html element and to move the elements as you see fit. You can remove any html element that has only bootstrap classes (row-fluid, small, pull-right etc), but you should not remove any html element that has a class starting with ccomment)
default_footer.php This file is responsible for the footer that is displayed at the bottom of the template (Powered by ...) You can add your own footer text such as "Template designed by XYZ". However the user should be able to hide the footer by using the show footer options in the template parameters in the backend of the component.
default_form.php This file is responsible for the comment form. You are free to add new html classes to each element, but you should be carefull when removing html elements. You should not remove any html elements that have a class starting with ccomment -> this can lead to javascript errors and the component will stop to function.
default_menu.php This file contains the code that makes the menu in the template (Comments (number of comments) add a comment \ RSS\ search buttons). Don't remove any elements that have a class starting with ccomment
default_search.php This file is responsible for the search form
default_searchresults.php This file styles the search results
readmore.php This file is responsible for the readmore button that is shown in frontpage view (category view etc). And it also loads the code for the comment preview
readmore_preview.php This file is responsible for the comment preview when on frontpage view (category view etc)The

The CComment6 template generate HTML code that is manipulated with javascript. We useVue.js templates. Code like this is a placeholder - it will be replaced live on the page with the help of our javascript.

In each of the template files you have access to the global configuration option for CComment. You can access any ccomment options by using $this->config->get('fields_name.field_name')