Chamilo
Chamilo 1.11 - English
Chamilo 1.11 - English
  • Introduction
  • Teacher Guide
    • Introduction
    • Getting to know Chamilo
      • What is Chamilo?
      • About this guide
      • Who is this guide for?
      • How to use this guide.
      • General usability
      • Why Chamilo?
        • Learning paradigm
        • Common interface elements
    • The Chamilo homepage
    • Registering on the platform
    • Finding your way in Chamilo
    • Course creation
    • Control course access
    • Organizing courses
      • Personal categories
      • Subscribing to other courses
      • Courses management icons
    • Course administration
    • Course homepage
      • Introductory text
      • Authoring tools
      • Interaction tools
      • Administration tools
    • First Steps: Documents
      • Create a directory
      • Quick-change of directory
      • Importing a document
      • Authoring content in Chamilo
      • Saving documents
      • Deleting a file or a directory
      • Watching course quotas
      • Slideshow
    • Interactivity: Tests
      • Introduction
      • Creating a new test
      • Feedback, score and correct answers
      • Test types
      • Adding questions to the test
      • Recycling existing questions
      • Importing: HotPotatoes, IMS/QTI2, Excel
      • Test results
    • Communication : Forums
      • Using forum views
      • Add forum categories
      • Add forum
      • Manage forum categories
      • Manage forums
      • Start a new topic
      • Manage discussion threads
      • Manage messages
      • Give your learners a score
      • Give a score from a message
      • Add a message to a thread
      • Reply to a specific message
      • Quote a previous message
      • Reply or Reply to this topic
      • Search a forum element
    • Structure: Learning paths
      • Introduction
      • Create a learning path
      • Add Learning Objects and Activities
      • Import AICC and SCORM
      • Managing learning paths
      • Prerequisites
      • Generating certificates
    • Reporting
      • Tracking learners
      • Show individual learner's details
      • Course reporting
      • Resource Reporting
      • Test/exam Reporting
    • Assignments
      • Assignment creation
      • Completion of assignments by students
      • Manage assignments
      • Setting up the assignment evaluation
      • Assignment expiry dates
      • Marking assignments
    • Users
      • Subscribe users
    • Assessments
      • Assessments pre-configuration
      • Sub-assessments
      • Adding classroom activities
      • Adding online activities
      • Weights
      • List view
      • How students generate certificates
      • Students certificates management
      • Linking assessments with skills
      • Linking certificates with learning paths
    • Wiki
      • Starting the wiki
      • Add a new linked page
      • Add a new orphan page
      • Commenting a page
      • Other wiki features
    • Links
      • Links categories
      • Links
      • Manage links
      • Links checker
    • Announcements
      • Add an announcement
      • Announcements management
    • Glossary
      • New term
      • Glossary terms management
    • Attendances
      • Create an attendance sheet
      • Recording attendances
    • Course progress
      • Create a thematic section
      • Define the thematic plan
      • Create steps for the course progress
    • Agenda
      • Adding an event to the course agenda
      • Import and export events
      • Adding an event to the personal Agenda
    • Dropbox
      • Folders
      • Send a file to specific users
      • Managing dropbox files
      • Read and add comments on a file
    • Groups
      • Create a group
      • Groups settings
      • Auto-filling a group
      • Fill a group manually
      • Getting into a group space
      • Overview /Export of group members
      • Groups management
    • Chat
      • Send a message
      • Empty messages
    • Survey
      • Survey creation
      • Add survey questions
      • Survey preview
      • Survey publication
      • Results
      • Surveys management
    • Notebook
      • Notes creation
      • Sort notes
    • Projects
      • Project creation
      • Subscribe learners to a project
      • New article/task
      • Roles management
      • Assign a role to a learner
      • Indicate the execution of a task
      • Learners' task management
    • Course settings
      • Update general course settings
      • Visibility and access
      • E-mail notifications
      • User rights
      • Chat settings
      • Learning path settings
      • Thematic advance settings
    • Backup
      • Create a backup
      • Import backup
      • Copy course
      • Empty this course
    • The Reporting tab
      • Own courses and sessions reporting
    • Social network
      • Profile information
      • Internal messaging
      • “Friends”
      • Social groups
      • My files
    • Session view
      • Courses tab
      • Learning paths tab
      • My MCQ tab
      • My statistics tab
    • Appendix
      • Glossary
      • Frequently asked questions
      • Document license
      • Document history
  • Admin Guide
    • Getting to know Chamilo
      • About this guide
      • Whom is this guide meant for?
      • How to read this guide?
    • Installation and configuration
      • Server
      • Installation wizard
        • Launching the installation wizard
          • Step 1 of 6 : Language
          • Step 2 of 6 : Prerequisites
          • Step 3 of 6: License
          • Step 4 of 6 : MySQL database parameters
          • Step 5 of 6: Configuration settings
          • Step 6 of 6 : Last check before installation
        • Last installation settings
      • Updating Chamilo
        • Download the latest stable version
        • Replace the older version by the new one
    • Backups
      • External backups
        • PhpMyAdmin database backup
        • Command-line backup
        • The Chamilo root directory
      • Saving the Chamilo interface
        • Learning path export
        • Saving a course
      • Recovering a backup
        • Learning paths
        • Courses
        • Complete recovery
    • Platform administration
      • Chamilo configuration settings
        • Portal
        • Training (admin/courses)
        • Sessions
        • Languages
          • Creating a sub-language
          • Defining one's own terms
          • Assigning the new sub-language
        • Users
        • Modules
        • HTML Editor
        • Security
        • Tuning
        • Assessments
        • Time zones
        • Reporting
        • Search
        • Stylesheets
        • Templates
        • Plugins
        • LDAP
        • CAS
        • Shibboleth
        • Facebook
      • Portal news
      • Global agenda
      • Edit portal homepage
      • Setting the registration page
      • Statistics
      • Reports
    • Users management
      • User roles
        • Learner (admin/or student)
        • The course assistant
        • The human resources manager (admin/or supervisor)
        • The course coach
        • The session coach (admin/or session tutor)
        • Teacher (admin/or trainer)
        • Sessions administrator
        • Portal administrator
        • Global administrator
        • Special case: the anonymous user
      • Users list
        • Learner
        • Teacher
        • Administrator
        • Anonymous
      • Add a user
      • Export users list
      • Import users list
      • Add groups
      • Groups list
      • Profiling
    • Courses management
      • Courses list
        • Update course details
        • Tracking and backup
      • Create a course
      • Export courses
      • Import courses list
      • Courses categories
      • Add users to course
      • Import users list
    • Sessions management
      • Use cases
        • The academic year
        • Personal tutoring
        • Corporate induction courses
      • Managing the sessions
      • Add a session
      • Sessions categories (admin/or periods)
      • Export sessions list
      • Copy from course in session to another session
      • Move users results from/to a session
      • Careers and promotions
        • Careers
        • Promotions
        • Copy
        • Use case
      • Classes
    • System
      • Special exports
      • System status
      • Data filler
      • Archive directory clean-up
    • Global features
      • Multi-URL
        • Use case – University faculties
        • Use case – Corporate branding
        • The solution
        • Installation
      • Video-conference
      • Chamilo Rapid
      • Style sheets
      • Templates
      • Web services
      • The Prestashop plugin
      • The Drupal plugin
      • The xAPI plugin
      • Logging in with OpenID
      • Securing your site with SSL / HTTPS
      • Optimization
    • Appendix
      • Frequently asked questions
        • Sending e-mails from the platform doesn't work
        • How do I prevent teachers to subscribe or unsubscribe learners into/from their courses?
        • How do I block access to the course catalog for learners?
        • How much bandwidth does the videoconference tool (admin/BigBlueButton) consume?
      • Security in Chamilo LMS
      • Database structure
      • Accessing the database
      • Configuration settings list
      • Glossary
      • Document license
      • Document history
  • Developer Guide
    • Introduction
      • About this guide
      • Who is this guide for?
      • How to use this guide
      • General usability
    • Why Chamilo?
      • Learning paradigm
      • Common interface elements
    • The Chamilo files & database structure
      • History
      • Database structure : fixed in all minor versions
      • The Chamilo LMS files structure today
      • The Chamilo LMS database structure today
      • General conventions for future database structure
    • Coding conventions
    • Theming through templates
      • Cleaning the cache
      • Structure of a page
      • Usable variables
      • Modifiers
    • Theming through CSS
      • The cascading structure
      • Style files purposes
      • The stylesheets inclusion mechanism
      • Extending the icons set
      • Default course image
      • Example procedure for new design
    • Document templates
      • Structure
    • Theming certificates
    • Customizing the online editor
    • The Chamilo logo
    • Global settings
      • Sub-languages
    • Participating to the development
      • Using Git
      • Updating you code
    • Clear the template cache
    • Fixing bugs
    • System AdministratorsWeb services
      • SOAP, REST and XML-RPC
      • Connection and security key
      • Restriction on calling IP addresses
      • Other methods
    • Extra Chamilo fields
    • Plugins
      • General workflow of plugins
      • General plugins development
      • The Dashboard
      • Language variables
    • System AdministratorsAuthentication methods
      • LDAP
      • CAS
      • Shibboleth
      • Facebook
      • OpenID
      • Custom SSO methods
    • Passwords generation
Powered by GitBook
On this page
  • The _u array
  • The _p array
  • The _s array
  • The _c array
  • Individual variables
Export as PDF
  1. Developer Guide
  2. Theming through templates

Usable variables

Because we want this template system to be practical for us, and because we don't want to always be assigning all the common variables we'll need rightat the end of our scripts, Chamilo comes with a set of pre-defined variables and arrays you can use.

Here is a list of those variables and arrays... Not that it might not be exhaustive and that, at this time, we have no way of helping you list these, but you could hack into main/inc/lib/template.lib.php and search for all $this->assign('literal', $variable) ; calls to find out.

The _u array

The _u array contains general information about the user. You could get the user's firstname to be printed inside any tpl by using the following syntax :

{{ _u.firstname }}

Here is a complete list of the values it contains, together with an example of the value you'll get from them. As you will see, some of these are duplicated under a slightly different name. We recommend always using the lowercase variables, as others should be cleaned out progressively in the future.

[complete_name] => John Doe
[complete_name_with_username] => John Doe (admin)
[firstname] => John 
[lastname] => Doe 
[firstName] => John 
[lastName] => Doe 
[mail] => john@example.com
[email] => john@example.com
[picture_uri] => 
[user_id] => 1 
[official_code] => ADMIN 
[status] => 1 
[auth_source] => platform
[active] => 1 
[username] => admin 
[theme] => 
[language] => english 
[last_login] => 2014-01-11 15:21:57
[lastLogin] => 2014-01-11 15:21:57
[avatar] => http://my.chamilo110.net/main/img/unknown.jpg
[avatar_sys_path] => /var/www/chamilo-lms/main/img/unknown.jpg
[avatar_small] => http://my.chamilo110.net/main/img/unknown_22.jpg
[logged] => 1 
[is_admin] => 1 
[messages_count] => 0
[messages_invitations_count] => 0

The _p array

This array contains a list of different forms of paths that you might need at the template level, for example to link to other resources.

[web] => http://my.chamilo110.net/
[web_course] => http://my.chamilo110.net/courses/ 
[web_main] => http://my.chamilo110.net/main/ 
[web_css] => http://my.chamilo110.net/web/css/ 
[web_css_theme] => http://my.chamilo110.net/web/css/themes/chamilo/
[web_ajax] => http://my.chamilo110.net/main/inc/ajax/ 
[web_img] => http://my.chamilo110.net/main/img/ 
[web_plugin] => http://my.chamilo110.net/plugin/ 
[web_lib] => [http://my.chamilo110.net/main/inc/lib/](http://my.chamilo19.net/main/inc/lib/)// only since 1.9.8 or later
[web_upload] => http://my.chamilo110.net/app/upload/
[web_self] => [http://my.chamilo110.net/courses/ABC/index.php](http://my.chamilo19.net/courses/ABC/index.php)
[web_query_vars] => cidReq=ABC&id_session=0
[web_self_query_vars] => [http://my.chamilo110.net/courses/ABC/index.php?cidReq=ABC&id_session=0](http://my.chamilo19.net/courses/ABC/index.php?cidReq=ABC&id_session=0)
[web_cid_query] => cidReq=ABC&id_session=0&gidReq=0&gradebook=0&origin=...

You could get the basis of the courses directory to be printed inside any tpl by using the following syntax :

{{ _p.web_course }}

Note that system paths, although easily available otherwise in the PHP scripts, are not provided here, as they should never be shown to the final users (even in the HTML source code).

The _s array

This array contains some system variables representing general platform information

[software_name] => Chamilo 
[system_version] => 1.11.6
[site_name] => My campus 
[institution] => My Organisation
[date] => Wednesday, January 31st 2018 // only available starting 1.10.0
[timezone] => Europe/Brussels
[gamification_mode] => true/false

i.e. you can get the site name (as configured in the global settings) to be printed inside any tpl by using the following syntax :

{{ _s.site_name }}

The _c array

This array (only present starting from 1.9.8) contains information about the current course.

You can check if the current course is defined (i.e. if the user is inside a course right now) by using the course_is_set variable :

{ % if course_is_set %}

… template elements

{ % endif %}

The _c array looks like this :

[id] => MODULE3 
[code] => MODULE3 
[title] => Module 3
[visibility] => 1
[language] => spanish 
[directory] => MODULE3 
[session_id] => 0// only since 1.9.8
[user_is_teacher] => true
[student_view] => false

As you can see, it also contains the session ID. Session ID is always 0 when we are not in a session at all.

You can also use, from the tpl, the {{ course_code }} variable, which is equivalent to {{ _c.code }}.

Although a bit more complex already, you could decide whether or not you'd want to show a link to a course by checking its visibility, like so:

{ % if _c.visibility == 1 %}
   <a class="pull-right"  href="{{ _s.web_course}}{{ _c.directory }}/index.php">{{ _c.title }}</a>
{% endif %}

As you can see, we combined several variables here, including one from the _s array, to write a condition that will show a full link to the course homepage to the user, only if the course has a visibility of « 1 ».

Individual variables

Other variables are defined individually but are always available inside any template.

As for the previous groups, the list below should be self-explanatory through the example values provided. In some cases, we add a comment after a « // » sign to give you more info.

system_charset => utf-8
document_language => en
style => chamilo_red // the CSS used at this time, subfolder of main/css/
favico => [http://my.chamilo110.net/favicon.ico](http://my.chamilo19.net/favicon.ico)
logo => 
online_button => … //an HTML tag to show if another user is online
offline_button => … //an HTML tag to show if another user is offline
title_string => My portal – My organisation – Portal name
bug_notification_link => … //HTML tag representing the bug reporting icon
notification_menu => 
…menu => 
breadcrumb => 
profile_link => 
message_link => 
logout_link => [http://my.chamilo110.net/index.php?logout=logout&amp;uid=5](http://my.chamilo19.net/index.php?logout=logout&uid=5)
administrator_name => John Doe
teachers => Samuel Lee, Mark Hansen
header_extra_content => 
footer_extra_content => 
session_teachers => 
help_content => 
actions => 
show_footer => 
show_header => true //whether the header block should be shown or not
show_toolbar => 
css_file_to_string => 
css_style_print => 
js_file_to_string => 
extra_headers => 
show_course_shortcut => true or null //icons that appear if enabled
show_course_navigation_menu => true or null //icons that appear if enabled// since 1.9.8 only
css_styles => chamilo_red // disambig. of CSS/style vs theme vs template
template => default // disambiguation of CSS (*.css) vs template (*.tpl)

i.e. you can get the name of the current CSS in use (and so get elements from the images/ folder in there) simply by using the following syntax:

PreviousStructure of a pageNextModifiers

Last updated 4 years ago