SMF Online Manual

*
  • Home
  • Community
  • Download
  • Customize
    • Modifications
    • Themes
    • Upgrades
  • Support
    • Function Database
  • Online Manual
  • About
  • Contribute
  • Development
 

Documentation of the moment:

What can I do if I accidentally delete my admin account?


  • Home
  • Help
  • Search
  • Login
  • Register

  • SMF Online Manual »
  • Using SMF »
  • As an Administrator »
  • Main »
  • Packages »
  • Topic: Manual Installation of Mods
 
Install SMF Installing Upgrading Converting
Using SMF User Moderator Administrator
Advanced Mods and Themes More Info
Glossary Terminology FAQs References Feature List What's New
Comments Feedback Requests
« previous next »
Manual Installation of Mods
Originally Written by A.M.A.

Mods are installed on the default Theme's template files. It is hard for a Mod's author as well as a Theme creater to make Mods work with other Themes especially if they have several of their own template files. When a template file is not found in a custom non-default Theme the Theme will rollback and use the default Theme's template file. But for the template files that the custom Theme does use, you will need to manually install the mod on to your custom Themes template files if the mod edited the same template file in the default Theme. To apply a Mod to any Theme manually use the following steps.

Unzip or un-archive the Mod package, and look for a file ending with .mod or .xml. If you do not see a ".mod" file, then chances are the mod author is using the newer XML format - look for something like "modification.xml" or "modname.xml".

If this applies to a .xml file please skip to the XML Format instructions below.

1. 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 are looking for here is a template file i.e. index.template.php, BoardIndex.template.php ..etc.

2. 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.

3. 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>

The above tells us 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.
Replace 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.

XML Format Instructions

The XML format differs slightly from the format described earlier. Once you get the hang of it, it's pretty easy though. Using the same examples as above:

1. Open the .xml file with any text editor and search for <file name="...">. You will find the filename in the "name" attribute.

2. Open up the specified file and look for a set of <operation>...</operation> tags. This indicates a single modification step within the specified file.

3. Within the operation tags, you will see two more pairs of XML tags: <search position="...">...</search> and <add>...</add>. The <![CDATA[ and ]]> tags are there to make sure the text doesn't get parsed as HTML or XML, and are not part of the code to search for or add. This is where it gets confusing. The position attribute of the search tag indicates where the code you're searching for should be in relation to what you're adding (not where you should add the code):

after - Find the code and add the specified code before it (same as <add before>...</add before>)
before - Find the code and add the specified code after it (same as <add after>...</add after>)

There are two other special positions that are relatively easy to understand:
end - Add the specified code at the end of the file.
replace - Find the code and replace it with the specified code (same as <replace>...</replace>).

For example:

Code: [Select]
<file name="$themedir/Display.template.php">
<operation>
<search position="replace"><![CDATA[
// Show the anchor for the top and for the first message.  If the first message is new, say so.
]]></search>

<add><![CDATA[
global $bar_exps, $bar_posts;

 // Show the anchor for the top and for the first message.  If the first message is new, say so.
]]></add>
</operation>
</file>

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.
Print
Reply
Reply with quote



Comments:
Quote
SleePy made the following comment on May 26, 2007, 10:16:05 PM:

Don't forget Daniel15's Mod Parser.
http://modparser.dev.dansoftaustralia.net/
This will give you a GUI (Graphical User Interface) of how to install a modification.

Quote
TeaTephi made the following comment on November 09, 2008, 07:05:44 PM:

Hey that parser helped me a lot!  To modify my profile.template.php file!

Quote
Arun made the following comment on December 06, 2008, 10:41:46 AM:

hi can anyone first paste any xml file with out editing and again paste an edited file fully becoz that makes clear than before , if possible take some package for ur example give the package link and users can download it and you paste that package xml file fully without editing and next paste edited xml file , please do it for me , i installed the smf beta version and when installing the package it says modification parser error can any one help me

Quote
Jade made the following comment on December 06, 2008, 11:44:08 PM:

Lol, try this out:
http://sleepycode.com/index.php/action,modmake.html

Quote
Jade made the following comment on February 16, 2009, 05:33:40 PM:

TO BE REMOVED: THIS SHOULD BE AN FAQ

Quote
Maddy made the following comment on April 06, 2009, 02:42:10 PM:

I have modifications_smfv2.xml open, and I've got three different instances of <file name="...">

<file name="$boarddir/index.php">
<file name="$sourcedir/Admin.php">
<file name="$sourcedir/ManageSettings.php">

Which file do I edit?

Quote
Jade made the following comment on April 07, 2009, 11:41:59 PM:

Each of them, however you can use the mod site parser now. Go back to the page the mod is on on the cus site:
http://custom.simplemachines.org/mods/

Find the mod, check the version you're downloading, then select your SMF version from the drop down and hit submit :). It will tell you what to find and replace ;D.

Quote
butlimous made the following comment on April 12, 2009, 03:01:44 PM:

Thnx for the useful tutorial  :)

Quote
donjoe made the following comment on April 13, 2009, 07:51:36 AM:

First of all, these instructions should also be accessible through
SMF Online Manual > Into the Depths of SMF > Information on Developing Mods and Themes  > Modifications and Understanding SMF's source
... because in the links used to get there it doesn't say "... on Developing Mods...", it just says "Advanced"..."Mods and Themes", and this happens to be an advanced topic about Mods, so THAT'S WHERE I LOOKED FOR IT FIRST. M'kay? (God I hate it when user guides are obfuscated and just as confusing as the problem you're trying to solve.)


Secondly, this:

Quote
after - Find the code and add the specified code before it
before - Find the code and add the specified code after it

... is pure stupidity, bound to cause confusion for users and to make manual mod installations seem harder than they really are. Let's get something straight: when someone's reading an XML installation procedure, they're trying to find out what they need to do to get the desired result. So when they see the word "before" they will think they need to insert something BEFORE something else, m'kay? Before = insert before, not "make it so that what you searched for and found ends up being positioned before what you're going to insert", i.e. the contradictory bullshit "before = insert after".

Please get your heads on straight. ::)
Thank you.

Quote
Jade made the following comment on April 13, 2009, 08:27:27 PM:

Please read the comments, this document is outdated :).

Quote from: Jade on April 07, 2009, 11:41:59 PM
Each of them, however you can use the mod site parser now. Go back to the page the mod is on on the cus site:
http://custom.simplemachines.org/mods/

Find the mod, check the version you're downloading, then select your SMF version from the drop down and hit submit :). It will tell you what to find and replace ;D.

Quote
donjoe made the following comment on April 18, 2009, 06:01:30 AM:

Quote from: Jade on April 13, 2009, 08:27:27 PM
Please read the comments, this document is outdated :).

Sorry, but that "mod parser" is more outdated than this document. Have you looked at its supported SMF versions list? ;)

Quote
Jade made the following comment on April 19, 2009, 05:57:46 PM:

The supported "versions" are what the mod is compatible with if you are referring to my quoted post above. The mod site parser is brand new :).

"you can use the mod site parser now. Go back to the page the mod is on on the cus site:
http://custom.simplemachines.org/mods/

Find the mod, check the version you're downloading, then select your SMF version from the drop down and hit submit :). It will tell you what to find and replace ;D."

Quote
Nicka made the following comment on April 30, 2009, 04:35:24 AM:

This is probably one of THE most confusing and stupid ways I have EVER seen to install a mod. I am personally frustrated and irritated with this crap. I should have fought my community to stick with PHPBB and there simple ways to install mods. I have done everything (reread everything 3 times) and I still get the text [youtube] showing up instead of the player. Highly disappointed, if anyone feels like giving me a quick (and simple) run down on how to install this mod I would be greatly appreciative.

aim= overdelt

Quote
Jade made the following comment on May 02, 2009, 01:20:48 PM:

I'm about ready to just overwrite this document with this:

Quote from: Jade on April 13, 2009, 08:27:27 PM
Please read the comments, this document is outdated :).

Quote from: Jade on April 07, 2009, 11:41:59 PM
You can use the mod site parser now. Go back to the page the mod is on on the cus site:
http://custom.simplemachines.org/mods/

Find the mod, check the version you're downloading, then select your SMF version from the drop down and hit submit :). It will tell you what to find and replace ;D.



Advertisement:
  • Powered by SMF 2.0 RC2 | SMF © 2006–2009, Simple Machines LLC
  • XHTML
  • RSS
  • WAP2

Page created in 0.114 seconds with 17 queries.
Page served by: 10.0.100.134