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:
<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:
// Show the anchor for the top and for the first message. If the first message is new, say so.
and replace it with:
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? (http://www.simplemachines.org/community/index.php?topic=34543.0)
where can i find this Mod package? thanks man!
Quote from: mrichard on April 28, 2005, 07:46:55 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
Very helpful A.M.A., thanks for posting this. :)
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.
Very nice FAQ, just translated it into german language, posted in the german language support forum:
Wie wende ich Mods auf Themen (Skins) an? (http://www.simplemachines.org/community/index.php?topic=34543.0)
Added the link to the german transl. at the bottom of the 1st post.
Quote from: A.M.A on April 28, 2005, 07:20:30 PM
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?
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.
ah, ok, that explains it :)
Thanks for posting this. I just followed it step by step with the gmail mod & found it really simple and easy to do. :D
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
You should ignore the "![CDATA[" and the "]]>" tags ;)
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
dont matter finally done it after hours of learning lol
:D
crev
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?
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 ;)
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
this was most certainly very helpful! Thank you! :)
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 or www.HeadlessHorsemen.org/forums 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) <!-- 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.
<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
<?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 '
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 (http://www.simplemachines.org/community/index.php?topic=43401.0) 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.
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
<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 ;
I cant figure this out at all, way too confusing for me :'( can anyone help me out please?! add me to msn:
[email protected]Thanks
All this is so confusing to me,, in .mod file i have something like <file name="$themedir/Post.template.php"> , how can i change it so it`ll make the changes to Post.template.php of classic theme??????? :'(
Turkish Translation(by Elmacik) is here (http://www.simplemachines.org/community/index.php?topic=60382.0)
All of this is extremly confusing to me :-X
Cant i just rename the default theme folder to something .. then rename my custom theme folder to "default" .. then install the mods ... then rename back the folders ???
I guess that wont work .. no ?
Ok I have a question. SO I've got the Pn-Pn theme on my site. Previously I was using the default one that comes with RC2. I've installed a LOT of mods and it would be pretty tiring to get all of em migrated to my new theme's files. SO could I do this?:
Make pn-pn my default theme and then goto package manager and uninstall the mods, then install them again. ?
Please let me know.
Thanks in advance
im running smf 1.0.7 and helious multi as my theme I cannot for the life of me figure it out anyone willing to do it for me its installed but only works on the default theme.
Quote from: A.M.A 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:
<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:
// Show the anchor for the top and for the first message. If the first message is new, say so.
and replace it with:
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? (http://www.simplemachines.org/community/index.php?topic=34543.0)
In my staff.xml file it says for me to open index.template.php, but I do not see this code in there:
// Show the anchor for the top and for the first message. If the first message is new, say so.
Any ideas?
thanks
i cant understand a thing
So how does one install a mod to a theme that does not contain the code in the <search for> tag?
I'm trying to install the mouseover preview mod to the other themes of our forum and the BlackDay theme does not have the necessary lines of code in messageindex.template.php. Does this mean the mod cannot be installed in that theme?
Please help me!!!!
I try to work with paidsubs in my template pdx-dk03RC3. I try allready for 4 weeks but I't wont work.
When this is working I can promote my website. Can any one please help me to let paidsub work????? :-[
I wonder if I can use this howto for tiny portal too. Can I?
Very confusing. Can some one help me to appy the ad_mod_1-0-8_v1-0-2c with "Converted Theme from YaBB SE" or "Classic Theme from YaBB SE" Theme?
What do I do if a file says to edit a theme file but the theme doesn't have that file?
<file name="$themedir/Display.template.php">
But the theme doesn't contain a Display.template.php file so what do I do?
if the theme doesnt have that file it uses the one from the default theme
themes only contain the files that have been changed from the default
so if the mod is available in all themes it normally modifies the default theme on install so any files no in other themes have already been changed in the default or if the mod applies to the theme but not default copy the file from the default theme into your theme then edit it. :)
So what you are saying is that I only need to edit the files that are contained in new theme directory? And if it says to edit a file that is not there then I don't have to do anything?
as long as the mod is installed in your default theme, yes
SO, when it says FILE NOT FOUND when installing the theme.... what should I do?
Honestly, the default theme is WAY too complex, I think, to be a default theme. It's way too graphic heavy IMHO.
Does anyone have simpler CSS for the default theme that doesn't use all these fancy graphics and stuff? It's such a pain in the butt.
I want to edit the mod package for visual warning which I was to install on 1.0.8. However it has 5 files with the .mod extension. These are:
VisualWarning_SMF11R3
VisualWarning_SMF10
VisualWarning_SMF11b3
VisualWarning_SMF11R1
VisualWarning_SMF11R2
Which one should I edit?
i would say the one ending in 10 as the others match 1.1 releases and have 11 in the name
Hi, please help me with this, I tried installing SMF Gallery with VB Green Skin Theme, but I can't make the Gallery button to be shown on the toolbar, please help me with this, tell me what to do. Thanks :)
I have a question, i pretty much have this all figured out except for one thing. When looking for the file in the theme that you were told to go to when searching the mod "modification" file. If the mod.xml or .mod file lists a file that is not in my theme what do i do there? do i just leave it alone? Also if I need to find a code in the theme file i was directed to and the code is not there does that mean i dont have to replace it?
if the file is not in your theme then the theme uses the one from the default theme which should be automatically updated when you install the theme.
if the replace code doesnt exist in your theme this means that your theme does it differently to the default, this is the reason why the package manager doesnt install onto non default themes, what you need to do is find the code that does the same job in the theme you are using, and replace it with code that does the same job as the code the default code get replaced with.
the simplist example of this is adding links to mods in the menu in custom themes.
ie "FORUM HELP SEARCH PROFILE..."
to "FORUM MODLINK HELP SEARCH PROFILE..."
in some themes these will be images so you will need to make a image for the mod link and make sure it appears in the right place with the correct borders/spacing between links etc. to match the rest of the buttons from that theme. but in themes where the links are text you may only have to add a simple text link into the code for that mod.
If the code does not appear in your custom theme but the file it should be in does I would first look for similar code, (in the case of the menu i would search for the calender button and copy the code for that changing calender to the name of your mod every time it appears), and then if you cant work out where it goes first ask the mod author then the mods author, the themes author should be able to tell you where the code that does the same job as that in the default is and the mods author should be able to tell you what the changes to the code do.
Is there perhaps a way to create a mod that will do all the steps necessary to make another mod compatible with another theme?
there is a way and its not that hard to do one that installs a particular version of a mod on a particular version of smf with this particular list of other mods installed into a particular theme.
but the reason that they dont generally get made is that there are so many combinations that it very quickly becomes impractical to do it for all cases.
hi
how to search for codes in theme settings
examle...I can't install smf shop...
I can't find some code
i'm lost too, i've been changing bits to get this to work on my theme but no luck, it works on the standard default theme but not the board's default which is set to helios multi, which bits do i change???
<!-- Edit a specific file.. -->
<file name="$boarddir/index.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="after"><![CDATA['activate' => array('Register.php', 'Activate'),]]></search>
<!-- Add this text when we find it. Note that it's on it's own line on purpose, and the CDATA keeps things clean. -->
<add><![CDATA['usercp' => array('usercp.php', 'usercp'),]]></add>
</operation>
</file>
<file name="$themedir/index.template.php">
<operation>
<search position="after"><![CDATA[if ($context['current_action'] == 'search2')]]></search>
<add><![CDATA[if ($context['current_action'] == 'usercp')
$current_action = 'usercp';
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))]]></search>
<add><![CDATA[if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'usercp', 'mlist', 'register', 'login', 'help', 'pm')))
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>]]></search>
<add><![CDATA[<a href="', $scripturl, '?action=usercp">' , $txt['usercp'] , '</a>
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.english.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[
We should make something that will do this for us, instead of having to open to tons of files and search for a line replace, save, look for another file, search etc...
For beginner is realy strange and confuse.
I already work with the procedure described above but unfortunately sometimes the default index.template.php and the index.template.php from the new theme are so different that I just cant find the codes before them or after them I should place something. Actually I have problems with the orange-lt theme and the add mod.
I only was able to add the codes for the header. For the skysrapers left and right and for the footer I couldn't add the add mod codes because couldn't find the codes "before" or "after" them I had to put the add codes.
i have problems with the sig option mod (http://custom.simplemachines.org/mods/index.php?mod=409)
i can leave the box unchecked and
after i post, my sig will still show up. i am using Aa_New_Damage_111 theme.
here is the code if anyone can help please?
this code is from sig.xml
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>vbgamer45:SigPost/id>
<version>1.0</version>
<file name="$languagedir/Modifications.english.php">
<operation>
<search position="after"><![CDATA[
?>]]></search>
<add><![CDATA[
//Begin Sig Post Strings
$txt['show_sig'] = 'Show Signature';
$txt['sig_topic'] = 'Show Signature Checked?';
//END Sig Post Strings
]]></add>
</operation>
</file>
<file name="$themedir/Post.template.php">
<operation>
<search position="before"><![CDATA[<tr>
<td class="smalltext"><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['back_to_topic'] . '</label></td>
<td class="smalltext">', $context['can_sticky'] ? '<input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['sticky_after2'] . '</label>' : '', '</td>
</tr>]]></search>
<add><![CDATA[
<tr>
<td class="smalltext" colspan="2"><label for="check_sig"><input type="checkbox" name="showsig" id="check_sig"' . (!empty($modSettings['sig_topic']) ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['show_sig'] . '</label></td>
</tr>
]]></add>
</operation>
</file>
<file name="$themedir/Display.template.php">
<operation>
<search position="replace"><![CDATA[// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))]]></search>
<add><![CDATA[
// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $message['showSIG'] == 1)
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[<textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" tabindex="1"></textarea><br />]]></search>
<add><![CDATA[
<label for="check_sig"><input type="checkbox" name="showsig" id="check_sig"' . (!empty($modSettings['sig_topic']) ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['show_sig'] . '</label><br />
]]></add>
</operation>
</file>
<file name="$sourcedir/Post.php">
<operation>
<search position="before"><![CDATA['smileys_enabled' => !isset($_POST['ns']),]]></search>
<add><![CDATA[
'sig_enabled' => @$_POST['showsig'],
]]></add>
</operation>
</file>
<file name="$sourcedir/Subs-Post.php">
<operation>
<search position="before"><![CDATA[$msgOptions['smileys_enabled'] = !empty($msgOptions['smileys_enabled']);]]></search>
<add><![CDATA[
$msgOptions['sig_enabled'] = empty($msgOptions['sig_enabled']) ? 0 : (int) $msgOptions['sig_enabled'];
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[// Insert the post.
db_query("
INSERT INTO {$db_prefix}messages
(ID_BOARD, ID_TOPIC, ID_MEMBER, subject, body, posterName, posterEmail, posterTime,
posterIP, smileysEnabled, modifiedName, icon)
VALUES ($topicOptions[board], $topicOptions[id], $posterOptions[id], SUBSTRING('$msgOptions[subject]', 1, 255), SUBSTRING('$msgOptions[body]', 1, 65534), SUBSTRING('$posterOptions[name]', 1, 255), SUBSTRING('$posterOptions[email]', 1, 255), " . time() . ",
SUBSTRING('$posterOptions[ip]', 1, 255), " . ($msgOptions['smileys_enabled'] ? '1' : '0') . ", '', SUBSTRING('$msgOptions[icon]', 1, 16))", __FILE__, __LINE__);]]></search>
<add><![CDATA[
// Insert the post.
db_query("
INSERT INTO {$db_prefix}messages
(ID_BOARD, ID_TOPIC, ID_MEMBER, showSIG, subject, body, posterName, posterEmail, posterTime,
posterIP, smileysEnabled, modifiedName, icon)
VALUES ($topicOptions[board], $topicOptions[id], $posterOptions[id], $msgOptions[sig_enabled], SUBSTRING('$msgOptions[subject]', 1, 255), SUBSTRING('$msgOptions[body]', 1, 65534), SUBSTRING('$posterOptions[name]', 1, 255), SUBSTRING('$posterOptions[email]', 1, 255), " . time() . ",
SUBSTRING('$posterOptions[ip]', 1, 255), " . ($msgOptions['smileys_enabled'] ? '1' : '0') . ", '', SUBSTRING('$msgOptions[icon]', 1, 16))", __FILE__, __LINE__);
]]></add>
</operation>
</file>
<file name="$sourcedir/Display.php">
<operation>
<search position="before"><![CDATA[$messages_request = db_query("
SELECT
ID_MSG, icon, subject,]]></search>
<add><![CDATA[ showSIG,]]></add>
</operation>
<operation>
<search position="before"><![CDATA['counter' => $counter,]]></search>
<add><![CDATA[
'showSIG' => $message['showSIG'],
]]></add>
</operation>
</file>
<file name="$sourcedir/ModSettings.php">
<operation>
<search position="before"><![CDATA[array('check', 'who_enabled'),]]></search>
<add><![CDATA[
//Sig Option mod
array('check', 'sig_topic'),]]></add>
</operation>
</file>
</modification>
can anyone please help me with the above problem??
ok i've uploaded and installed "users online today mod" & "googlebot" and i can't get either working in the theme my site uses but they work fine in the default theme
I have got no idea how to do all this your all talking about, it's confusing the hell out of me now and driving me nuts
can someone please help me sort this out?? much appreciated :)
anyone ?? please?
I really like this mod but really need it working in helios multi but i have no idea at all
Daniel15 has a "Package Parser" here: http://dev.dansoftaustralia.net/projects/modparser/ (http://dev.dansoftaustralia.net/projects/modparser/) which would tell you exactly what you needed to do to modify your custom theme to incorporate the Mod.
I used it a few times and it was good.
nice hmmm... after i download it that package parser .. do i need to install it on my SMF Package Manager?
I finally found this MOD (thanks for the replies...) I am using SMF 1.1.5 and appropriate MOD package 1.4.0 and I get this at the bottom of my forum (uses Babylon theme). The bold text is where I am sure something is missing. As well as there is nothing in the title bar:
QuoteUsers Online
2 Guests, 1 User (0 Buddies)
Users active in past 60 minutes:
EJR
Most Online Today: 22. Most Online Ever: 70 ( June 21, 2008, 13:39:12)
: 3 (: 3, : 0)EJR, Smoke50, Kerry Asst.40
I am also getting these recurring errors:
Quote8: Undefined index: uot_hidden (OR uot_visible.. total... etc..
File: /home/ejr19550/public_html/smf/Themes/babylon/BoardIndex.template.php (eval?)
Line: 442
I tried to follow everything I could find on this forum. I am just not good at coding PHP. Any help would be appreciated...
EJR, this topic is for teaching people how to manually add a mod to custom themes. It is not for the users online today mod. I would suggest you post your question in the topic for that mod, or on the authors site.
ok i am a bit lost (not hard)
I have done the search thing
and this is what i got
- <file name="$sourcedir/BoardIndex.php" error="fatal">
- <operation error="fatal">
- <search position="before" regexp="false" whitespace="exact">
- <![CDATA[ $context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];
]]>
</search>
- <add>
- <![CDATA[ // Load the users online today.
$date = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);
$s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
$time_fmt = '%I:%M' . $s . ' %p';
else
$time_fmt = '%H:%M' . $s;
$result = db_query("
SELECT
mem.ID_MEMBER, mem.lastLogin, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.lastLogin >= $midnight", __FILE__, __LINE__);
$context['num_hidden_users_online_today'] = 0;
$context['users_online_today'] = array();
$context['list_users_online_today'] = array();
while ($row = mysql_fetch_assoc($result))
{
if (empty($row['showOnline']))
{
$context['num_hidden_users_online_today'] = $context['num_hidden_users_online_today'] + 1;
if (!$user_info['is_admin']) continue;
}
$userday = strftime('%d', forum_time(true));
$loginday = strftime('%d', forum_time(true, $row['lastLogin']));
$yesterday = $userday == $loginday ? '' : $txt['uot_yesterday'];
$lastLogin = $yesterday . strftime($time_fmt, forum_time(true, $row['lastLogin']));
$title = ' title="' . $lastLogin . '"';
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . ' style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . '>' . $row['realName'] . '</a>';
$is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
if ($is_buddy)
{
$link = '<b>' . $link . '</b>';
}
$context['users_online_today'][$row['lastLogin'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'is_buddy' => $is_buddy,
'hidden' => empty($row['showOnline']),
);
$context['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = empty($row['showOnline']) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);
krsort($context['users_online_today']);
krsort($context['list_users_online_today']);
$context['num_users_online_today'] = count($context['users_online_today']);
if (!$user_info['is_admin'])
{
$context['num_users_online_today'] = $context['num_users_online_today'] + $context['num_hidden_users_online_today'];
}
]]>
</add>
BUT where do i put that code?
i have a simpler way.
instead of jumping into the code manually, just edit the files in the mod zipped package (installer).
this is how i did it (my smf is v1.1.6):
my environment: smf v1.1.6 with Highway Theme installed.
mod to install: thank-o-matic.
the steps:
1. extract all file in the thank-o-matic zip file to a directory. name it the same like the file name, "thank-o-matic"
2. open package-info.xml. it has all the installation files info.
3. now, let's do this first: take a look at your theme directory structure (mine is Highway theme), mine looks like this: "forumbinaraga.com/Themes/Highway"
4. using your favorite program, replace all "$themedir" with "Themes/Highway" at the package-info.xml
5. also, still using your favorite program, search the whole thank-o-matic directory for files contain "$themedir" and change them all to "Themes/Highway"
6. zip the the whole directory back into thank-o-matic.zip.
7. install it using the package manager (using upload)
8. test it. it will spit some errors; something like this:
---24. Execute Modification ./Themes/HighWay/Admin.template.php File not found <---
---25. Execute Modification ./Themes/HighWay/Display.template.php Test successful
---26. Execute Modification ./Themes/HighWay/ManageBoards.template.php File not found <---
---27. Execute Modification ./Themes/HighWay/Profile.template.php File not found <---
9. see, that's because those 3 files are not in the HighWay directory but instead in the default theme dir. so simply re-edit your files and change everything that has those three strings from "./Themes/HighWay" back to "$themedir".
10. repack the zip file and upload to server using package manager
11. retry to install. if all the test results are "successful" then you are ready to go.
12. don't forget to test it.
you can see the actual result at my site http://www.forumbinaraga.com (http://www.forumbinaraga.com).
ps:
important: don't forget to backup everything before you do any changes on production server. but, well... to be really really honest; i didn't do backup :P.
i haven't test this method with other mods yet. but i believe the principle is about the same.
this method will only work for themes that are similar in code to the default theme.
I do personally work in a similar way though because it leaves a trail of exactly what i changed and makes it a lot easier to uninstall.
I have got this problem with quite a few of the Mods on my site. Is there a way to get the themes to work? I'm using vB Green as my theme
The first post tells you how to get custom themes to work with custom mods.
I have tried the first post Method, it doesn't seem to comply with some of the recent Mods, when i look to find the Code it doesn't find anything
Quote from: Thantos 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.
Hey Thantos, very useful note.. ;) :)
I think for the xml files, is better to make a small guide to explain the actions step by step for rookies..
(like me.. :) :D)
I´m using !Karma Description Mod and it is working OK but there is one error message in Forum Amin and it says:
8: Undefined index: description
Datoteka: /var/www/vhosts/gaming.hr/httpdocs/forum/Sources/BoardIndex.php
Linija: 448
Please help!
Quote from: Thantos 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.
Hi,
I opened the xml file in the package after I unzipped it. I'm trying to find the "<edit file> _ </edit file> or <file name="_">" but never found them. Any help plase?
This is a very old guide topics. May be can still be used for SMF 1.1.x but will not be suitable for SMF 2.0 RCx. In SMF 2.0 RCx (2 and 3), you can choose to install mod to other theme as well. You can even emulate the forum version if need be (but I don't prefer and would advise to avoid this at all costs).
If the line of code is a little bit different due to other mod installed you can whether change it your self manually; OR uninstall previous mod and install the one you want first, and then re-install that previous mod; OR ask the mod author to make the mod friendlier with other mods.
Quote from: A.M.A 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:
<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:
// Show the anchor for the top and for the first message. If the first message is new, say so.
and replace it with:
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? (http://www.simplemachines.org/community/index.php?topic=34543.0)
sorry can u tell me my mod that just download no has file that contain .mod extraction
i'm trying use mod hideTopicReplies_1.5.zip and theme not default
thanks u
If it doesn't have a .mod file then it must use the .xml file. Instead of you reading that file, SMF provides a way to view the instructions on the mod page. Just select your version of SMF in the dropdown on the mod page and click parse.
hello dear all , i want to install site map mod on my smf ver : 1.1.11 can enyone help me ?
this is instal.xml code :
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>slammeddime:sitemap</id>
<version>2.1.2</version>
<file name="$boarddir/index.php">
<operation>
<search position="after"><![CDATA[ 'smstats' => array('Stats.php', 'SMStats'),
]]></search>
<add><![CDATA[ 'sitemap' => array('Sitemap.php', 'ShowSiteMap'),
]]></add>
</operation>
</file>
<file name="$sourcedir/Admin.php">
<operation>
<search position="before"><![CDATA[ // Note the comma!! The setting with automatically appear with the first mod to be added.
]]></search>
<add><![CDATA[ 'sitemap' => array($txt['sitemap']),
]]></add>
</operation>
</file>
<file name="$sourcedir/ManageSettings.php">
<operation>
<search position="before"><![CDATA[ // Mod authors, once again, if you have a whole section to add do it AFTER this line, and keep a comma at the end.
]]></search>
<add><![CDATA[ 'sitemap' => 'ModifySitemapSettings',
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[ 'description' => $txt['modification_settings_desc'],
'tabs' => array(
'general' => array(
),
]]></search>
<add><![CDATA[ 'sitemap' => array(
),
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[function ModifySitemapSettings($return_config = false)
{
global $txt, $scripturl, $context, $settings, $sc, $modSettings;
$config_vars = array(
array('check', 'sitemap_xml'),
array('int', 'sitemap_topic_count'),
array('int', 'sitemap_cache_ttl'),
'',
array('select', 'sitemap_30day_priority', array('1.0' => '1.0', '0.9' => '0.9', '0.8' => '0.8', '0.7' => '0.7', '0.6' => '0.6', '0.5' => '0.5', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1', '0.0' => '0.0')),
array('select', 'sitemap_60day_priority', array('1.0' => '1.0', '0.9' => '0.9', '0.8' => '0.8', '0.7' => '0.7', '0.6' => '0.6', '0.5' => '0.5', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1', '0.0' => '0.0')),
array('select', 'sitemap_90day_priority', array('1.0' => '1.0', '0.9' => '0.9', '0.8' => '0.8', '0.7' => '0.7', '0.6' => '0.6', '0.5' => '0.5', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1', '0.0' => '0.0')),
array('select', 'sitemap_91day_priority', array('1.0' => '1.0', '0.9' => '0.9', '0.8' => '0.8', '0.7' => '0.7', '0.6' => '0.6', '0.5' => '0.5', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1', '0.0' => '0.0')),
);
if ($return_config)
return $config_vars;
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=sitemap';
$context['settings_title'] = $txt['sitemap'];
// Saving?
if (isset($_GET['save']))
{
checkSession();
$save_vars = $config_vars;
saveDBSettings($save_vars);
redirectexit('action=admin;area=modsettings;sa=sitemap');
}
prepareDBSettingContext($config_vars);
}
]]></add>
</operation>
</file>
<file name="$themedir/index.template.php">
<operation>
<search position="before"><![CDATA[ <li class="copyright">', theme_copyright(), '</li>
]]></search>
<add><![CDATA[ <li><a href="', $scripturl, '?action=sitemap"><span>', $txt['sitemap'] ,'</span></a></li>
]]></add>
</operation>
</file>
<file name="$languagedir/Help.english.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[// SMF Sitemap Strings
$helptxt['sitemap_xml'] = 'When unchecked, the <em>link</em> to the XML sitemap will only be shown to admins. When checked, anyone can see it.';
$helptxt['sitemap_topic_count'] = 'This is the maximum number of topics that will be displayed in the XML sitemap. Default is 20000. You can set this to 0 to display all topics on your board';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.english.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[// SMF Sitemap Strings
$txt['sitemap'] = 'Sitemap';
$txt['sitemap_boards'] = 'Boards';
$txt['sitemap_xml'] = 'Show Sitemap XML <em>link</em>';
$txt['sitemap_topic_count'] = 'Maximum number of topics to display in XML sitemap<br /><span class="smalltext">0 to show all (<strong class="error">NOT RECOMMENDED ON LARGE BOARDS</strong>)</span>';
$txt['sitemap_cache_ttl'] = 'Time that XML data should be cached (seconds)';
$txt['sitemap_board_none'] = 'No boards to display';
$txt['sitemap_topic_none'] = 'No topics to display';
$txt['sitemap_30day_priority'] = 'Priority for topics active in the last 30 days';
$txt['sitemap_60day_priority'] = 'Priority for topics active in the last 60 days';
$txt['sitemap_90day_priority'] = 'Priority for topics active in the last 90 days';
$txt['sitemap_91day_priority'] = 'Priority for topics older than 90 days';
]]></add>
</operation>
</file>
<file name="$languagedir/Who.english.php">
<operation>
<search position="after"><![CDATA[$txt['whoall_collapse_collapse'] = 'Collapsing a category.';
]]></search>
<add><![CDATA[$txt['whoall_sitemap'] = 'Viewing the <a href="' . $scripturl . '?action=sitemap">' . $txt['sitemap'] . '</a>.';
]]></add>
</operation>
</file>
</modification>
i want it , please heeeeeeeeeeeeeeeeeeeelp :-\ :-\
Valuable posts for all.