Advertisement:

Author Topic: How to make mods work with themes?  (Read 91009 times)

Offline A.M.A

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,133
  • Gender: Male
  • ..
How to make mods work with themes?
« on: April 28, 2005, 07:20:30 PM »
Mods are mostly done to work with the default theme. It is hard for a Mod's author as well as a theme crater to make Mods work with each theme. However you can still apply a Mod to any theme manually using the following steps.

1. unzip the Mod package, and look for a file ending with .mod

2. open the .mod file with any text editor and search for <edit file></edit file> , you will find a file name after the tag. What we need here is looking for a template file i.e. index.template.php, BoardIndex.template.php ..etc.

3. If you locate any template after the <edit file> tag, you will find the <search for></search for> tag below it. It will contain a block of code that must be located in the specified template.

4. After the <search for> tag, you will find one of these:
<add after>…</add after> , which add a block of code after the code found.
<add before>…</add before> , which add a block of code before the code found.
<replace>…</replace> , which replace a block of code with the code found.

For example:
Code: [Select]
<edit file>
Themes/default/Display.template.php
</edit file>

<search>
// Show the anchor for the top and for the first message.  If the first message is new, say so.
</search>

<replace>
global $bar_exps, $bar_posts;

// Show the anchor for the top and for the first message.  If the first message is new, say so.
</replace>
And that means, we need to open Display.template.php and look for:
Code: [Select]
// Show the anchor for the top and for the first message.  If the first message is new, say so.
and replace it with:
Code: [Select]
global $bar_exps, $bar_posts;

// Show the anchor for the top and for the first message.  If the first message is new, say so.

Notice by: MikeMill
Please note that not all Mods use the .mod file but instead use .xml files.

For the most part they are the same.
Instead of <edit file>...</edit file> it will be <file name="...">
The second difference is that <search for> will be <search position="...">.

Now this is where it can be confusing.  If the position="before" that means what you are searching for will be before what you insert with the <add> block.  If position="after" that means what you are searching for will be after what you insert with the <add> block.  If position="replace" that means you will replace what you searched for with what you <add>.  Finally you may see a position="end".  That means what you <add> should go right before the ?> characters at the end of the file.

Addition:
A german translation of this text is here:
Wie wende ich Mods auf Themen (Skins) an?
« Last Edit: April 29, 2005, 06:53:01 AM by A.M.A »
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Offline Nitro

  • Full Member
  • ***
  • Posts: 668
  • Gender: Male
  • Be Kind
    • The Novoa's
Re: How to make mods work with themes?
« Reply #1 on: April 28, 2005, 07:46:55 PM »
where can i find this Mod package? thanks man!
MPF Rocks!!!

Offline dtm.exe

  • SMF Hero
  • ******
  • Posts: 5,465
Re: How to make mods work with themes?
« Reply #2 on: April 28, 2005, 08:25:52 PM »
where can i find this Mod package? thanks man!

That code that A.M.A posted is only to make a mod compatible with an incompatible theme.  To download the actual mods, click on the link below.

http://mods.simplemachines.org/index.php

-Dan The Man

Offline Miraenda

  • Full Member
  • ***
  • Posts: 598
  • Gender: Female
  • nihil sunt omnia
    • RatingBar.com - Real Reviews by Regular People
Re: How to make mods work with themes?
« Reply #3 on: April 28, 2005, 08:52:51 PM »
Very helpful A.M.A., thanks for posting this. :)

Offline Thantos

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,163
  • Gender: Male
Re: How to make mods work with themes?
« Reply #4 on: April 28, 2005, 09:06:14 PM »
To add:

Not all mods use the .mod file but instead use .xml files.

For the most part they are the same.
Instead of <edit file> _ </edit file> it will be <file name="_">

The second difference is that <search for> will be <search position=" ">.
Now this is where it can be confusing.  If the position="before" that means what you are searching for will be before what you insert with the <add> block.  If position="after" that means what you are searching for will be after what you insert with the <add> block.  If position="replace" that means you will replace what you searched for with what you <add>.  Finally you may see a position="end".  That means what you <add> should go right before the ?> characters at the end of the file.

Offline andrea

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,324
  • Gender: Female
  • I'm a smiley.
    • Smiley Sets
Re: How to make mods work with themes?
« Reply #5 on: April 29, 2005, 01:17:19 AM »
Very nice FAQ, just translated it into german language, posted in the german language support forum:
Wie wende ich Mods auf Themen (Skins) an?

Added the link to the german transl. at the bottom of the 1st post.
Andrea Hubacher
Ex Lead Support Specialist
www.simplemachines.org

Personal Signature:
Most recent work:
10 Aqua Themes for SMF



Offline Mystica

  • SMF Friend
  • Full Member
  • *
  • Posts: 458
  • Gender: Female
  • don't look at me as if I'm different
    • Mysti's World
Re: How to make mods work with themes?
« Reply #6 on: April 29, 2005, 03:52:09 AM »
Please note that not all Mods alter templates files only, some may require adding new template(s) to the theme for them to work.

doesn't the forum use the default theme's template files for the files that are not included in an additional theme? therefor after installing a mod it should only be necessary to modify the files that are already in the other themes. or am i missing something?
« Last Edit: April 29, 2005, 03:55:44 AM by Mystica »
~ there's nothing wrong with me, this is how I'm supposed to be ~

Offline A.M.A

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,133
  • Gender: Male
  • ..
Re: How to make mods work with themes?
« Reply #7 on: April 29, 2005, 06:59:55 AM »
Thnaks OIDanTheManIO for explaining.

Glad you find it of use Miraenda.

Thanks MikeMil for the addition.

Thanks andrea for translating it.

Yes Mystica it sounded confusing so I deleted it. I was refereeing to what to do in case of manual installation of the Mod, not applying it to the default theme then changing other themes.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Offline Mystica

  • SMF Friend
  • Full Member
  • *
  • Posts: 458
  • Gender: Female
  • don't look at me as if I'm different
    • Mysti's World
Re: How to make mods work with themes?
« Reply #8 on: April 29, 2005, 07:21:55 AM »
ah, ok, that explains it :)
~ there's nothing wrong with me, this is how I'm supposed to be ~

Offline IamV

  • Jr. Member
  • **
  • Posts: 124
Re: How to make mods work with themes?
« Reply #9 on: July 14, 2005, 06:14:21 PM »
Thanks for posting this.  I just followed it step by step with the gmail mod & found it really simple and easy to do.  :D

Offline vdubbia

  • Jr. Member
  • **
  • Posts: 145
Re: How to make mods work with themes?
« Reply #10 on: September 06, 2005, 07:47:47 PM »
Okay... can you tell me what I'm supposed to add out of the following two instructions... I'm getting confused with all of the brackets tacked onto the beginnings and ends of the code and the 'CDATA' syntax...

Quote
<add><![CDATA[ (empty($context['spiders']) ? '' : $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['ob_googlebot_spider'] : $txt['ob_googlebot_spiders']) . ', '), ]  ]></add>


Quote
<add><![CDATA[

   if (!empty($context['spiders']))
   {
      if ($modSettings['ob_googlebot_display_own_list'])
         echo '
            <br />
            ', $txt['ob_googlebot_spiders_last_active'], ':<br />';
      else
      {
         if (empty($context['users_online']))
            echo '
            ', $txt[140], ':<br />';
         else
            echo ', ';
      }
      
      echo implode(', ', $context['spiders']);
   }]]></add>



Thanks

Offline Eren Yaşarkurt

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,134
  • Gender: Male
  • aka forsakenlad
    • erenyasarkurt on Facebook
    • erenyasarkurt on LinkedIn
    • @erenyasarkurt on Twitter
    • yekolay
Re: How to make mods work with themes?
« Reply #11 on: September 06, 2005, 08:23:30 PM »
You should ignore the "![CDATA[" and the "]]>" tags ;)
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

yemek siparişi - order your food quick and easy

Offline crev

  • Newbie
  • *
  • Posts: 8
    • Zillion Hosting
Re: How to make mods work with themes?
« Reply #12 on: September 08, 2005, 07:05:02 PM »
im trying to install smf shop mod on another theme - 'igoh' and after being sat here for over 2 hours ive still not got anywhere. im no good the codes and this is really confusing me. could some one pls help me. i dont know where to start or finsih.

help appreciated.
Thank alot, Crev
hxxp:www.zillionhosting.co.nr [nonactive]

<a href="hxxp:www.resellerspanel.com/?a=username [nonactive]"><img src="hxxp:www.resellerspanel.com/banners/468x60_03.gif [nonactive]" width="468" height="60" border="0"></a>

Offline crev

  • Newbie
  • *
  • Posts: 8
    • Zillion Hosting
Re: How to make mods work with themes?
« Reply #13 on: September 08, 2005, 07:58:34 PM »
dont matter finally done it after hours of learning lol
  :D
crev
hxxp:www.zillionhosting.co.nr [nonactive]

<a href="hxxp:www.resellerspanel.com/?a=username [nonactive]"><img src="hxxp:www.resellerspanel.com/banners/468x60_03.gif [nonactive]" width="468" height="60" border="0"></a>

Offline chaking

  • Semi-Newbie
  • *
  • Posts: 50
Re: How to make mods work with themes?
« Reply #14 on: September 12, 2005, 05:22:44 AM »
So if you have an xml file (or .mod I suppose), couldn't you just extract that, change the $themedir to something that actually refers to the theme you want it installed on, compress it and use the package manager? The problem is I don't know what to change $themedir to... any suggestions?

Offline Eren Yaşarkurt

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,134
  • Gender: Male
  • aka forsakenlad
    • erenyasarkurt on Facebook
    • erenyasarkurt on LinkedIn
    • @erenyasarkurt on Twitter
    • yekolay
Re: How to make mods work with themes?
« Reply #15 on: September 12, 2005, 10:32:27 AM »
You can but all the themes don't have the same layout so it might and with themes that change the layout much it would not work ;)
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

yemek siparişi - order your food quick and easy

Offline plezops

  • Newbie
  • *
  • Posts: 1
Re: How to make mods work with themes?
« Reply #16 on: November 17, 2005, 01:46:43 AM »
AHHH, im trying to install the XFire mod (.xml) file and after about 2 hours of work, it still doesnt work. If anyone could be of assistance on how to make it work with the Helios theme that would be great!

Thanks

Offline Prasad007

  • SMF Hero
  • ******
  • Posts: 1,557
  • Gender: Male
  • JOOMLA AND SMF FAN!!
Re: How to make mods work with themes?
« Reply #17 on: December 18, 2005, 11:20:28 AM »
this was most certainly very helpful! Thank you! :)

Offline NiCr0

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • I feel ashamed i didnt find SMF sooner.
    • SMF has changed my life, Thank you SMF!
Re: How to make mods work with themes?
« Reply #18 on: January 22, 2006, 04:53:27 PM »
Ok i'm having some complications here. I'm decent at coding mostly in HTML with minor minor php exp. so from reading this topic and all posts, i'm still a bit confused.

I'm trying to install the XFire and Teamspeak packages/mods for my site forums. www.HeadlessHorsemen.org [nofollow] or www.HeadlessHorsemen.org/forums [nofollow] for direct forum link.

In the Teamspeak (most important at this time for me) its using the .xml file. I have on Lines 23-25 (using Dreamweaver 8 Pro)
Code: [Select]
<!-- Edit a specific file.. -->
<file name="$themedir/Profile.template.php">
<!-- A seach operation, with search rules and code to modify the file with. -->

Then again on lines 44-45 i have.
Code: [Select]
<file name="$themedir/Display.template.php">
<!-- A seach operation, with search rules and code to modify the file with. -->

in my display.template.php file i have Lines 1-9 displaying this
Code: [Select]
<?php
// Version: 1.0; Display

function template_main()
{
global $context$settings$options$txt$scripturl$modSettings;

// Show the anchor for the top and for the first message.  If the first message is new, say so.
echo &#39;

I'm totaly confused on what to add or change. perhaps im just not comprehending the way i change/edit this? i do apologize if this has been answerd which obviously it has im sure. the Teamspeak thread (located: Here didnt really help much either).

The skin that i'm using is:
Daze Skin by Diplomat | Unofficial Grey Version modified by maCe
version: SMF 1.1 RC2

Thanks in advance for any advice, solutions, help, suggestions or anything else.

Offline NiCr0

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • I feel ashamed i didnt find SMF sooner.
    • SMF has changed my life, Thank you SMF!
Re: How to make mods work with themes?
« Reply #19 on: January 25, 2006, 02:35:16 AM »
Ok I do appologize for the spam, after i took the time to "think" and re read and study the way the code worked for this,

the code i needed to find was
Code: [Select]
<file name="$themedir/Display.template.php">
<!-- A seach operation, with search rules and code to modify the file with. -->
<operation>
<!-- Search for this text before the code we add.  You can also search for after, and the end of the file. -->
<search position="before"><![CDATA[ // Show their personal text?
if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
echo '
', $message['member']['blurb'], '<br />
<br />';]]></search>

What confused me, the position="before" and the <![CDATA[ tag's. Once i looked it over for a few moments, i realized what the orginal post said.

if the statement says,
postition="before" then, what ever it is searching for, the <add></add> will be placed before the text shown.  the texted that im looking for isn't starting with <![CDATA[ it starts after that second [ and ends after the ;