Firefox PHP

Module: Spritmonitor (Gas Mileage and Vehicle's Costs Calculator)

All files from this thread

File Name File Size   Posted by Date  
spritmonitor-1.0.2.zip 61.9 KB open | download Oliver Riesen-Mallmann 07/28/2016 Read message
Module: Spritmonitor (Gas Mileage and Vehicle's Costs Calculator)
May 28, 2008 10:23AM
Module: Spritmonitor
Version: 1.0.2
Author: Oliver Riesen-Mallmann <oliver@riesen.org>

Adds mileage icon from Spritmonitor.de (Gas Mileage and Vehicle's Costs Calculator) to user profile.

Tested on version 5.2.20.


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.


Installation:

1. Unpack the archive.

2. Move the directory "spritmonitor" 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 "Spritmonitor".

5. Templates must be configured to show mileage icon. 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 icon 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_spritmonitor}{INCLUDE "spritmonitor::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_spritmonitor}{INCLUDE "spritmonitor::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_spritmonitor}{INCLUDE "spritmonitor::read_threads"}{/IF}
   |_______________________________________________________________________________|
    <div class="message-date">{MESSAGE->datestamp}</div>
</td>
...
...

* profile.tpl (if you want the user's mileage icon 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_spritmonitor}{INCLUDE "spritmonitor::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/spritmonitor/templates/emerald
to
  mods/spritmonitor/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?


Contribution:

Contribute on GitHub:
[github.com]


Changelog:

2016/07/27 version 1.0.2 by Oliver Riesen-Mallmann <oliver@riesen.org>
- Fixed template files to work with https too.

2015/08/20 version 1.0.1 by Oliver Riesen <oliver@riesen.org>
- Rewrite of install file.

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


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
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 2 time(s). Last edit at 07/28/2016 03:00AM by Oliver Riesen-Mallmann.
Attachments:
open | download - spritmonitor-1.0.2.zip (61.9 KB)
Re: Module: Spritmonitor (Gas Mileage and Vehicle's Costs Calculator)
August 20, 2015 08:13AM
New version 1.0.1:

2015/08/20 version 1.0.1 by Oliver Riesen <oliver@riesen.org>
- Rewrite of install file.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
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.
Re: Module: Spritmonitor (Gas Mileage and Vehicle's Costs Calculator)
July 28, 2016 03:01AM
New version 1.0.2:

2016/07/27 version 1.0.2 by Oliver Riesen-Mallmann <oliver@riesen.org>
- Fixed template files to work with https too.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
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