[SPLIT]Delete/Replace argument

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

Adding a DELETE instruction would be VERY useful, but I thought it has already been answered that this solution (below) was NOT permitted? :(
Davidls wrote: A temporary solution for DELETE is to do a blank FIND/REPLACE WITH

I agree that it's the best solution waiting for a real DELETE action but it needs to be officially authorised :roll:

A part from that I agree with Ptirhiik.
The template needs to be boost one good time to add useful and logical needs, and there is many important ones.

Just one example: being able to add instructions to modify the DB is a good thing, but the new SQL action seems a bit too restrictive.
Most of MOD authors now use php files to update the phpBB DB and there is many good reasons for that (as fixing table prefix potential issues).
The phpBB group itself uses php files to proceed updates so why can't we do the same in our MODs how-to ?

I think sometimes you focus your attention on details which are not necessarily the most important. A few days ago I read an amazing discussion about how to write "MOD" in "MOD Author".
The debate was what is accepted: "mod", "Mod" or "MOD" :(

But...
#1 EM can use a php function to be sure to read the good string in any case (lower each letter for example) - so that's not a problem
#2 For the MODs DB, I think that's a bit too much to refuse a MOD only because its written "Mod" and not "MOD" ; and it's easy to create a small software that can switch any case in writing the header entries to the good one - so that's not a problem too
#3 And the most important: why obliging to write "MOD..." ?
All entries on the header are about the MOD of the how-to! Why behind "Author" should we need to add "MOD" and not behind "Installation Level" for example?

We loose our time talking about this kind of details.
Simplify guys, and focus on the real needs to go ahead quicker than other competitors! :)
Last edited by -=ET=- on Mon Aug 04, 2003 11:56 am, edited 3 times in total.
Eternal newbie
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

-=ET=- wrote: I agree that it's the best solution waiting for a real DELETE action but it needs to be officially authorised


That FIND/REPLACE WITH {blank} has (just about) always been the correct method to remove code.

The better method is, of course, to comment out the code with either: // or /* */, however, the more simple /replace with 'blank' is the more typical way to do it, and is fully acceptable.

I cannot recall a time when I've ever had a MOD denied for using either of these methods.

Thanks for your addressing this issue.
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

AbelaJohnB wrote: That FIND/REPLACE WITH {blank} has (just about) always been the correct method to remove code.

The better method is, of course, to comment out the code with either: // or /* */, however, the more simple /replace with 'blank' is the more typical way to do it, and is fully acceptable.

I cannot recall a time when I've ever had a MOD denied for using either of these methods.

OK.

So my information on this point was wrong.
Thanks for your answer! :)
Eternal newbie
User avatar
Ptirhiik
Registered User
Posts: 7411
Joined: Mon Jan 06, 2003 10:36 pm
Contact:

Post by Ptirhiik »

AbelaJohnB wrote: That FIND/REPLACE WITH {blank} has (just about) always been the correct method to remove code.
hu ? I have asked you about this one sometimes ago, and you answered "no : something must stand in the action" (not litteraly :)). This makes btw some sense, as it would be very comfusing for the user to deal with an empty instruction : "damn, something missing there !".

REPLACE WITH commented can not be used on tpls in certain case (within a tag ie).
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

Ptirhiik - RPGnet-fr,

There must have been some mis-understanding in what you were asking, and what I was explaining.

We have been stating that method is allowable for probably 6-8 months.
User avatar
Ptirhiik
Registered User
Posts: 7411
Joined: Mon Jan 06, 2003 10:36 pm
Contact:

Post by Ptirhiik »

Well, let's clarify it so : would it be accepted to have this :

Code: Select all

#
#-----[ FIND ]------------------------------------------------
#
$foo = $otherfoo;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
chickeneater
Registered User
Posts: 400
Joined: Wed May 21, 2003 3:16 pm

Post by chickeneater »

or this?:

Code: Select all

# 
#-----[ FIND ]------------------------------------------------ 
# 
$foo = $otherfoo; 
# 
#-----[ REPLACE WITH ]---------------------------------------- 
#
//$foo = $otherfoo;
# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT »

or simply:

#
#-----[ FIND ]------------------------------------------------
#
$bleh = $blehr;
$foo = $otherfoo;
#
#-----[ REPLACE WITH ]----------------------------------------
#
$bleh = $blehr;
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM

:D
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

DanielT wrote: or simply:

#
#-----[ FIND ]------------------------------------------------
#
$bleh = $blehr;
$foo = $otherfoo;
#
#-----[ REPLACE WITH ]----------------------------------------
#
$bleh = $blehr;
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM

No.
This solution is too dangerous and/or not EM compliant!

The ligne after and/or the line before can have been modified by another MOD and it's useful and dangerous to want to replace a line which have nothing to do with the MOD.

You may try to find it with the whole line and never be able to find it (especially EM), or find it with a part of the line but need to replace the whole line with a wrong code then.

That's not a good solution.
Eternal newbie
LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

In some cases, that solution will work just fine. For instance, if the l line after (or before) what you want to remove is a } or a { then this would be no problem, as it would leave the } {, which will always stay on it's own line if it were to meet the phpBB coding standards.
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT »

This solution is too dangerous

erm how?
and/or not EM compliant!


there is no reason that easy MOD should have a problem with that
User avatar
Ptirhiik
Registered User
Posts: 7411
Joined: Mon Jan 06, 2003 10:36 pm
Contact:

Post by Ptirhiik »

hep guys, the question I ask was much more simpler :) : will the mod I quote be denied or not ;).

Of course there are other solution to do the same thing, and quite all have their usage depending the case : at this time, the only way to deal with real delete (because ie of an upgrade) is to find from a non-modified line and to replace with this non-modified line, and actually, but I can tell for him, I don't think Nutzzi will considered this way to proceed EMC, even if easymod can perform it, as the line involved can of course be modified too.

Adding a new mod to the board isn't really involving the delete process on php (tpls is another thing), but removing or upgrading it does, and can't be avoid. All your proposal are simili-solution in order to perform this action, and the one I quote wasn't convenient as I understood, but I have perhaps misunderstood.
Note also letting a blank line after the "replace with" should be interpreted by the user as adding a carriage return, which is absolutly not what we want here (think about templates ie), and would remain very comfusing.
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Post by -=ET=- »

LifeIsPain wrote: In some cases...

So that can not be a recommended solution.
LifeIsPain wrote: For instance, if the l line after (or before) what you want to remove is a } or a { then this would be no problem, as it would leave the } {, which will always stay on it's own line if it were to meet the phpBB coding standards.

That does not work too, sorry.

If you have...

Code: Select all

if (...)
{
old_code
}
A MOD insert one line...

Code: Select all

if (...)
{
old_code
line_inserted_by_MOD1
}
And you precisely choose to ask to do this in your MOD...

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
old_code
}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
}
...this will NOT work !
DanielT wrote: erm how?

I'm sorry I don't understand "erm" but I think you ask me why ? :P

Because, you have 2 possibilities to write a find instruction:
#1 you can ask to find the whole original line.
That's not EM compliant in most case, even manualy in some cases you will not be able to find the lines and in fact the webmaster will have to find it with a part of it, BUT... it's safe.
If there is a problem on the line anyone will see it, EM will not replace it, and the webmaster will adapt the code.

#2 but you can ask to find a line with a sub string of the original code.
That's EM compliant in most cases (in particular before IN-LINE instructions as EM ask to mostly proceed with only significative part of lines to prevent pb with modified lines), but if you do that before asking to replace all the 2 lines its dangerous.

If I have these 3 lines:

Code: Select all

<td>{postrow.1st_LINE1} {postrow.2nd_LINE1}</td>
<td>{postrow.1st_LINE2} {postrow.2nd_LINE2}</td>
<td>{postrow.1st_LINE3} {postrow.2nd_LINE3}</td>
...and want to delete the 2nd line.

If you chose to do that...

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
<td>{postrow.1st_LINE1}
<td>{postrow.1st_LINE2}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
<td>{postrow.1st_LINE2} {postrow.2nd_LINE2}</td>
...but the first line has previsouly been modified like that...

Code: Select all

<td>{postrow.1st_LINE1} {postrow.2nd_LINE1} {postrow.3rd_LINE1} {postrow.4th_LINE1}</td>
<td>{postrow.1st_LINE2} {postrow.2nd_LINE2}</td>
<td>{postrow.1st_LINE3} {postrow.2nd_LINE3}</td>
...you will delete the previous modification, and then it's dangerous !

So, this method is dangerous and/or NOT EM compliant in many case, as EM will not be able to find the original context.

But, I have one question: why do you want to take the risk to replace a line that has nothing to do with the MOD ? :roll:

You can already accept one of these solutions...

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
line_to find

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
// line to find

# 
#-----[ MEXT ACTION ]------------------------------------------ 
#
...

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
line_to find

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#

# 
#-----[ MEXT ACTION ]------------------------------------------ 
#
...

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
line_to find

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
# 
#-----[ NEXT ACTION ]------------------------------------------ 
#
...
...so why wanting to take a useful risk ?
Last edited by -=ET=- on Tue Aug 05, 2003 11:06 am, edited 3 times in total.
Eternal newbie
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT »

if you did this:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
line to find 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
// line to find 

# 
#-----[ MEXT ACTION ]------------------------------------------ 
# 
to this code:

Code: Select all

line to find
line to find
line to find
then you whould have the same problem :P
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

This is -quickly- turning into an Off-Topic conversation here people.

Perhaps it's best to start a new thread about this ;)


Let's try to keep this thread focused on the issues herein first addressed.


Thank you.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”