Mod Help

Started by John Slater, June 05, 2005, 01:27:51 PM

Previous topic - Next topic

John Slater

Hi i posted this a few minutes ago but in the wrong place, hopefully someone will delete the old one.

__________________________________________
ok here is the code i wrote using the template SMF has. I want to add some code to a file and as far as i know it should work, but it doesnt so something is wrong. I have uploaded it via the package manager and the file says fail when i try to install it. Please inform.

Its only a test mod but when i have it working i want to develop it more.

The code is below.

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is an example modification file for SMF packages.

ATTENTION: If you are trying to install this manually, you should try
the package manager.  If it will not work for you, please take a look
at the following for information on this format:
http://mods.simplemachines.org/docs/manual-install.php

================================================================================

Modification files can be used to modify files so that they do what
your package needs them to do to work properly.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<!-- This information needs to be the same as that in the package-info.xml. -->
<id>username:thesimpsonsjohn</id>
<version>1.1</version>

<!-- Edit a specific file.. -->
<file name="$themedir/Profile.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[
$context['member']['website']['url'], '" /></td>
]]></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[
</tr><tr>
<td><b>Real name: </b></td>
<td><input type="text" name="default_options[profile_real_name]" size="50" value="', @$context['member']['options']['profile_real_name'], '" /></td>
]]></add>
</operation>


</file>
</modification>


This is only step one, step two was deleted until i get step one working.

Hope you great guys can help.

rudoka

#1

<search position="before"><![CDATA[
<td><input type="text" name="websiteUrl" size="50" value="', $context['member']['website']['url'], '" /></td>
]]></search>


This works for me.
Though it just changes the Profile.template.php. In the forum the real name is still not visible. If that is what you wanted.

Rudolf

[Unknown]

This:

<![CDATA[
$context['member']['website']['url'], '" /></td>


Means:

"\n\$context['member']['website']['url'], '\" /></td>"

What you want is:

<![CDATA[$context['member']['website']['url'], '" /></td>

Without the \n in the front.

-[Unknown]

John Slater

sorry to be a pain, not quite sure what you mean. :-( that code you posted is on my mod as far as i can see, what am i doing wrong? and where?

sorry :-)

rudoka

It means that or you use what I said or you put what [Unknown] said.

Something like this:

<search position="before"><![CDATA[$context['member']['website']['url'], '" /></td>]]>
</search>


Mine works because I practically search for the whole line. Having the line break caracter both at the beginning and the end.
The CDATA must be exactly as in the file, spaces, tabs, line break and other white space characters included. Yours is not.  ;)
Thanks [Unknown] for pointing that \n out. I had no idea why it wouldn't work.

Rudolf

John Slater

ok i will try it now. :-) thanks.

John Slater

Ok, using the SDK thing, how do i make the script add code before (the line above) a certain point?

rudoka


<search position="after"><![CDATA[
<td><input type="text" name="websiteUrl" size="50" value="', $context['member']['website']['url'], '" /></td>
]]></search>
<add><![CDATA[
<tr>
<td><b>Real name: </b></td>
<td><input type="text" name="default_options[profile_real_name]" size="50" value="', @$context['member']['options']['profile_real_name'], '" /></td></tr>
]]></add>



You will need to include the whole line if you want to insert it before. If you use only $context['member']['website']['url'], '" /></td> it will insert before that code, meaning in themiddle of the line there. Which is not good, right?  ;)

OR you can do:

<search position="replace"><![CDATA[
<td><input type="text" name="websiteUrl" size="50" value="', $context['member']['website']['url'], '" /></td>
]]></search>

<add><![CDATA[
<tr>
<td><b>Real name: </b></td>
<td><input type="text" name="default_options[profile_real_name]" size="50" value="', @$context['member']['options']['profile_real_name'], '" /></td></tr>
<td><input type="text" name="websiteUrl" size="50" value="', $context['member']['website']['url'], '" /></td>
]]></add>


But I'm just guessing here, since I don't know what you really want to do.

Rudolf

John Slater

Thanks mate, i thought of putting after but didnt know whether it would work. But i got the mod to work, i have submitted it.

rudoka


Gary

The Mod site. My guess is that its waiting to be approved.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

rudoka

AHA!  :o
Well, I just finished my mod too. Two days ago.
   I was wondering how could I have it listed somewhere else then my own package server.
   But then I didn't saw much interest from people here, so I just dumped the idea. There is a mod already for what I wrote, and I don't care much anymore to have mine listed, anyway.

Hm, should I submit or should I go?  :-\
Rudolf

Gary

You can submit your mod here it'd be great if you could share your mod with the community, I feel.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

John Slater

my mod is submitted. When its approved i will make my Skype! mod.

John Slater

How long until my mod is accepted?  :)

dtm.exe

Quote from: John Slater on June 07, 2005, 11:42:30 AM
How long until my mod is accepted?  :)

When a Mod Developer dubs it safe for SMF, then it will be released.

-Dan The Man

rudoka

Quote from: OIDanTheManIO on June 07, 2005, 11:48:58 AM
Quote from: John Slater on June 07, 2005, 11:42:30 AM
How long until my mod is accepted?  :)

When a Mod Developer dubs it safe for SMF, then it will be released.

-Dan The Man

Maybe that's why my instinct says to don't bother submitting mine. lol

Gary

It varies, mine took a couple of days.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

dtm.exe

Quote from: Solid Snake on June 07, 2005, 12:03:09 PM
It varies, mine took a couple of days.

As did my mod.

-Dan The Man

John Slater

My first mod took 1 day, my last 2 havent been varified yet.

Advertisement: