News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to make mods work with themes?

Started by A.M.A, April 28, 2005, 07:20:30 PM

Previous topic - Next topic

SN

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

IchBin™

The first post tells you how to get custom themes to work with custom mods.
IchBin™        TinyPortal

SN

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

easyrider77

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)
SMF  1.1.11 / Joomla 1.5.20  /default theme

mbreber

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!

marwan

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?

Hj Ahmad Rasyid Hj Ismail

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.

morokat

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?

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 

IchBin™

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.
IchBin™        TinyPortal

imbuzz

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  :-\ :-\

Yung Roger

stickers printing [nofollow] folders printing [nofollow]

Advertisement: