Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Aiheen aloitti: heavyccasey - joulukuu 02, 2007, 07:09:48 IP

Otsikko: Indicate Section of Code That is a Mod
Kirjoitti: heavyccasey - joulukuu 02, 2007, 07:09:48 IP
I suggest that when SMF installs mods, SMF automatically adds a comment before and after an added snippet of code. For example:

Original Code:
$blah = 'foobar? What does that mean?';

Add After:
$second = 'Hi, this is just random';

Final Result:
$blah = 'foobar? What does that mean?';
// Start of the ABC Mod
$second = 'Hi, this is just random';
// End of the ABC Mod


The only problem I see is that the mod could be editing HTML code, in which "//" is not a comment.
Otsikko: Re: Indicate Section of Code That is a Mod
Kirjoitti: Rudolf - joulukuu 02, 2007, 07:14:01 IP
This should be the job of the mod creator.
I always put my additions between such comments, like this:

Koodi (PHP) [Valitse]

one line addition // ABC Mod -



Koodi (PHP) [Valitse]

// ABC Mod - START
multiple line addition
// ABC Mod - END


Koodi (HTML) [Valitse]

<!-- // ABC Mod - START -->
some html code
<!-- // ABC Mod - END -->


Koodi (CSS) [Valitse]

/* // ABC Mod - START */
some css code
/* // ABC Mod - END */


So mostly you just have to search for // ABC mod to find where are the changes.

You can't always make this automatic.
Otsikko: Re: Indicate Section of Code That is a Mod
Kirjoitti: Thantos - joulukuu 03, 2007, 12:34:42 AP
I agree that the mod author should add any needed comments.  Since the package manager can edit anything in the file it would be impossible to do this.  The code could be in a query, in PHP, part of the HTML output, in a JS file, etc.