Firefox PHP

Module: CarCost (Car Operating Costs and Mileage Statistics)

Posted by Oliver Riesen 
All files from this thread

File Name File Size   Posted by Date  
carcost-1.0.1.zip 9.8 KB open | download Oliver Riesen 08/26/2008 Read message
Module: CarCost (Car Operating Costs and Mileage Statistics)
May 28, 2008 04:11PM
Module: CarCost
Version: 1.0.1
Author: Oliver Riesen <oliver@riesen.org>

Adds link to CarCost (Car Operating Costs and Mileage Statistics) to user profile.

Tested on version 5.2.8.


License:

Free to use, modify, or redistribute this code so long as I am given credit for the original development somewhere. This code comes with absolutly no warranty.


Requirements:

Minimum Phorum version: 5.2.0.


Installation:

1. Unpack the archive.

2. Move the directory "carcost" to the directory "mods" within your Phorum installation. Don't change the directory name!

3. Login as administrator in Phorum's administrative interface and go to the "Modules" section.

4. Enable the module "CarCost".

5. Templates must be configured to show mileage link. Suggested template changes are included below.


Module settings:

This module doesn't have settings.


Language support:

This module supports multiple languages.

The following languages are included:

- English
- German (formal)
- German (informal) male
- German (informal) female

If you want to translate the module to a new language, you'll have to do the following:

Copy lang/english.php to lang/yourlang.php (yourlang.php must have the same name as Phorum's main language file that you use). After this, translate the strings in lang/yourlang.php.

If you have created a translation for this module, please post a zip file containing lang/yourlang.php in this module thread at phorum.org, so the translation can be added to the module package.


Main template customization:

To display the mileage link on various Phorum pages, you will have to edit the Phorum template files. Here is a description of the files and some sample implementations for the emerald template. The added code is shown here inside the a box.

* read.tpl (flat read mode)

Incorporate the code for example like below, to make it show up under the user details.


...
...
<td width="100%">
    <div class="message-author icon-user">
        {IF MESSAGES->URL->PROFILE}<a href="{MESSAGES->URL->PROFILE}">{/IF}{MESSAGES->author}{IF MESSAGES->URL->PROFILE}</a>{/IF}
        {IF MESSAGES->URL->PM}<small>[ <a href="{MESSAGES->URL->PM}">{LANG->PrivateReply}</a> ]</small>{/IF}
    </div>
    _____________________________________________________________
   |                                                             |
    {IF MESSAGES->user->mod_carcost}{INCLUDE "carcost::read"}{/IF}
   |_____________________________________________________________|

    <small>
    <strong><a href="{MESSAGES->URL->READ}">{MESSAGES->subject}</a> {IF MESSAGES->new}<span class="new-flag">{MESSAGES->new}</span>{/IF}</strong><br />
    {MESSAGES->datestamp}
    </small>
</td>
...
...

* read_hybrid.tpl (hybrid read mode)

Incorporate the code for example like below, to make it show up under the user details.


...
...
<td width="100%">
    <div class="message-author icon-user">
        {IF MESSAGES->URL->PROFILE}<a href="{MESSAGES->URL->PROFILE}">{/IF}{MESSAGES->author}{IF MESSAGES->URL->PROFILE}</a>{/IF}
        {IF MESSAGES->URL->PM}<small>[ <a href="{MESSAGES->URL->PM}">{LANG->PrivateReply}</a> ]</small>{/IF}
    </div>
    _____________________________________________________________
   |                                                             |
    {IF MESSAGES->user->mod_carcost}{INCLUDE "carcost::read_hybrid"}{/IF}
   |_____________________________________________________________|

    <small>
    <strong><a href="{MESSAGES->URL->READ}">{MESSAGES->subject}</a> {IF MESSAGES->new}<span class="new-flag">{MESSAGES->new}</span>{/IF}</strong><br />
    {MESSAGES->datestamp}
    </small>
</td>
...
...

* read_threads.tpl (threaded read mode)

Incorporate the code for example like below, to make it show up under the user details.


...
...
<td width="100%">
    <div class="message-author icon-user">
        {IF MESSAGE->URL->PROFILE}<a href="{MESSAGE->URL->PROFILE}">{/IF}{MESSAGE->author}{IF MESSAGE->URL->PROFILE}</a>{/IF}
        {IF MESSAGE->URL->PM}<small>[ <a href="{MESSAGE->URL->PM}">{LANG->PrivateReply}</a> ]{/IF}
    </div>
    _____________________________________________________________
   |                                                             |
    {IF MESSAGE->user->mod_carcost}{INCLUDE "carcost::read_threads"}{/IF}
   |_____________________________________________________________|
    <div class="message-date">{MESSAGE->datestamp}</div>
</td>
...
...

* profile.tpl (if you want the user's mileage link to appear in the profile
page)

Incorporate the code for example like below, to make it show up under the user details.


...
...
    {IF PROFILE->date_last_active}
        <dt>{LANG->DateActive}:&nbsp;</dt>
        <dd>{PROFILE->date_last_active}</dd>
    {/IF}
    _____________________________________________________________
   |                                                             |
    {IF PROFILE->mod_carcost}{INCLUDE "carcost::profile"}{/IF}
   |_____________________________________________________________|
</dl>
...
...


Module template customization:

By default, this module will use the template files from the directory "templates/emerald".

If you want to modify the templates to make them work better for your site's template, then do not edit the template files that were in the module distribution. Instead, copy the full directory
  mods/carcost/templates/emerald
to
  mods/carcost/templates/yourtemplatename
(asuming that your active site's template is stored as "templates/yourtemplatename") and edit the files in the new directory. Phorum will automatically recognize that you have created a specific template set to use for your site's active template.


Sanity Checks:

If you have problems with this module login as administrator in Phorum's administrative interface and go to the "System Sanity Checks" section. Check for warnings or errors for the CarCost Module.

The following checks are performed:

- Exists custom profile field?
- Exists default language file?
- Exists forum specific language file(s)?
- Custom language file(s) contains same array keys as the english file?
- Templates contain includes?


Changelog:

2008/05/25 version 1.0.0 by Oliver Riesen <oliver@riesen.org>
- Initial release for Phorum 5.2.

2008/08/26 version 1.0.1 by Oliver Riesen <oliver@riesen.org>
- Bug fix undefined index in template read.tpl.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.




Edited 1 time(s). Last edit at 08/26/2008 12:03AM by Oliver Riesen.
Attachments:
open | download - carcost-1.0.1.zip (9.8 KB)
Re: Module: CarCost (Car Operating Costs and Mileage Statistics)
August 26, 2008 12:04AM
New version 1.0.1:

2008/08/26 version 1.0.1 by Oliver Riesen <oliver@riesen.org>
- Bug fix undefined index in template read.tpl.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.

Click here to login