Welcome, Guest. Please Login or Register.
May 02, 2025, 11:55:30 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Change only a part of a line? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Change only a part of a line?  (Read 392 times)
Sauron
Jr. Member
**
Posts: 57


ICQ - 22683560 WWW
Change only a part of a line?
« on: May 03, 2002, 10:47:20 AM »
Reply with quote

Hi,

I'am writing on a Mod and I've added a checkbox in the ModSettings.php. And now the problem: For use the checkbox I must add a variable to the line "$onoffArray = array('stickyTopicsChecked'=>'enableStickyTopics', ..." in the ModifyModSettings2 function. If I replace this line BoardMOD will not find it, if thers any other MOD installed, that change this line. But when I  search only for a part of this line, I'll get an error from BoardMOD.
Is there any other way to change only a part of a line?

Thanks for help
Daniel
Logged

The Dark Lord
Jedi~
Eric
Beta Tester
YaBB God
*****
Posts: 1284


WWW
Re:Change only a part of a line?
« Reply #1 on: May 03, 2002, 06:13:06 PM »
Reply with quote

Use search for and replace, just replace the line with the changed portion plus the rest of unchanged portions.

Only way to do it.
Logged
Myiasis
Full Member
***
Posts: 178


I'm a llama!

Re:Change only a part of a line?
« Reply #2 on: May 03, 2002, 06:39:09 PM »
Reply with quote

You can add items to the array on separate lines if you want. That's what I  chose to do because I didn't want to make that line any bigger than it already was. I search for the text that uses the array rather than the array text in case other mods have changed it already.

<Search For>
   foreach ($onoffArray as $check => $var)
   {
      $onoff = isset($HTTP_POST_VARS[$check]) ? 1 : 0;
</Search For>

<Add Before>
   // Calendar.
   $onoffArray['enableCalendarChecked'] = 'cal_enabled';

</Add Before>
« Last Edit: May 03, 2002, 06:39:27 PM by Myiasis » Logged
Sauron
Jr. Member
**
Posts: 57


ICQ - 22683560 WWW
Re:Change only a part of a line?
« Reply #3 on: May 05, 2002, 12:26:41 PM »
Reply with quote

Thanks Myiasis, it works.
Logged

The Dark Lord
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Change only a part of a line? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.104 seconds with 20 queries.