Adjusting the component's look and feel

Though RSMembership! comes with a well organized display, there may be times when you would like to improve / adjust the look and feel of a certain area. The RSJoomla.com team thought this through and designed RSMembership! in such a way that almost every view can be adjusted via template overrides.

Template overrides offer tremendous flexibility in terms of content look and feel. Basically you can control any aspect - HTML output and CSS, without affecting the component's update process (changes to the source code would have been lost if an update occurred). As a drawback, this method requires a basic understanding of PHP, HTML and CSS.


This technique consists in duplicating the component's (this works for modules too) view files into the template's HTML folder. A complete list of which file controls what view can be found below:

  • the single membership layout (through the Single Membership Layout menu item) - \components\com_rsmembership\views\membership\tmpl\default.php
  • the default memberships layout (through the Memberships - default layout menu item) - \components\com_rsmembership\views\rsmembership\tmpl\default.php
  • the general memberships listing layout (through the Memberships - list layout menu item) - \components\com_rsmembership\views\rsmembership\tmpl\list.php
  • the default categories layout (through the Categories - Default Layout menu item) - \components\com_rsmembership\views\categories\tmpl\default.php
  • the general categories listing view (through the Categories - List Layout menu item) - \components\com_rsmembership\views\categories\tmpl\list.php
  • the subscriber's memberships listing (through the Show Subscriber's Memberships menu item) - \components\com_rsmembership\views\mymemberships\tmpl\default.php
  • the subscriber's account (through the Show Subscriber's Account menu item) - \components\com_rsmembership\views\user\tmpl\default.php
  • the terms and conditions view (through the Terms and Conditions Layout menu item) - \components\com_rsmembership\views\terms\tmpl\default.php

If you are new to Joomla! development, then it is probably easiest to start with an existing view, and try modifying it to achieve the desired result. To do this, you should make a copy of the existing view in the html directory of your template, and then modify the copy. The directory structure would be similar to this:

TEMPLATE_NAME/html/EXTENSION_NAME/VIEW_NAME/FILE_NAME.php

For example, if you wish to change the way how the categories default listing (through the Categories - Default Layout menu item) are displayed, then you should copy the list.php file, maintaining the directory structure within the template's HTML folder:

copy: PATH_TO_JOOMLA/components/com_rsmembership/views/categories/tmpl/default.php
to: TEMPLATE_NAME/html/com_rsmembership/categories/default.php
 

As an example, if you would like to add the membership description, simply replace the following piece of code:

 
  <li class="sectiontableentry<?php echo $k . $this->escape($this->params->get('pageclass_sfx')); ?>" >
    <a href="<?php echo JRoute::_('index.php?option=com_rsmembership&view=rsmembership&catid='.$item->id.':'.JFilterOutput::stringURLSafe
    ($item->name).$this->Itemid); ?>"><?php echo $this->escape($item->name); ?></a><?php if ($this->params->get('show_memberships', 0)) 
    { ?> (<?php echo $item->memberships; ?>)<?php } ?></li>
  </li>
 

with this one:

 
  <li class="sectiontableentry<?php echo $k . $this->escape($this->params->get('pageclass_sfx')); ?>" >
    <a href="<?php echo JRoute::_('index.php?option=com_rsmembership&view=rsmembership&catid='.$item->id.':'.JFilterOutput::stringURLSafe
    ($item->name).$this->Itemid); ?>"><?php echo $this->escape($item->name); ?></a><?php if ($this->params->get('show_memberships', 0)) 
    { ?> (<?php echo $item->memberships; ?>)<?php } ?>
    <p><?php echo $item->description;?></p>
  </li>
 

The information that is displayed regarding each membership is stored in variables(for example the $item in the above example), you can see all the information that can be used regarding a membership in a certain view by using the var_dump() function:

 
  <?php var_dump($item); die();?>
 

This will return the event information in the following syntax:

 
  object(stdClass)#158 (6) { ["id"]=> string(1) "1" ["name"]=> string(10) "Category 1" ["description"]=> string(11) "Description"
 

3 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that