Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Modding files  (Read 4570 times)

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 469
Modding files
« on: February 15, 2007, 02:52:05 pm »

Here is my idea.

When I did my one mod I took the function that I modded and copied it into a new file, let us say mod.php and then comment out the original snews.php function. Mod the copy then add include('mod.php') to my template and I have a mod without damaging the original in case I need to revert back or upgrade.

Any thoughts on this method?
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Modding files
« Reply #1 on: February 15, 2007, 03:04:20 pm »

There is nothing wrong with this method at all. Your file-name can be anything... as long as the include statement uses the same name to call it into operation. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 469
Modding files
« Reply #2 on: February 15, 2007, 03:37:18 pm »

I figured it was the easiest way to do the mods without screwing up my configuration and files at the same time.
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

brauck

  • Hero Member
  • *****
  • Karma: 18
  • Posts: 556
    • http://www.hbw-webdesign.nl/
Modding files
« Reply #3 on: February 15, 2007, 04:44:59 pm »

This is a nice approach  :)
Logged
Confidence is reduced complexity.
brauck.nl for free css templates

piXelatedEmpire

  • MIA
  • ULTIMATE member
  • ******
  • Karma: 37
  • Posts: 1401
  • currently MIA
Modding files
« Reply #4 on: February 16, 2007, 12:00:40 am »

this seems like a great idea!

tarm, would you like to perhaps create a tutorial or example of what you did? Maybe a step by step approach - could be very beneficial for those interested in doing something similar :D

It would be much appreciated :)
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Modding files
« Reply #5 on: February 16, 2007, 12:23:12 am »

pix, am already working on such ;)
Logged
Of all the things I have lost, it is my mind that I miss the most.

4Sandrix

  • Hero Member
  • *****
  • Karma: -13
  • Posts: 597
    • http://fedrick.deviantart.com
Modding files
« Reply #6 on: February 16, 2007, 12:37:27 am »

some of mods requer to change some of lines in snews.php so I don't think that this approach is "universal"
Logged
I'm kind of like Han Solo always strokin' my own Wookiee
I'm the root of all that's evil yeah but you can call me Cookie

piXelatedEmpire

  • MIA
  • ULTIMATE member
  • ******
  • Karma: 37
  • Posts: 1401
  • currently MIA
Modding files
« Reply #7 on: February 16, 2007, 01:02:39 am »

well actually 4Sandrix, what tarm is doing is commenting out the entire function that needs to be modded and adding that modded function to a seperate file..

the only draw back i can see is if you have a heavily modified snews.php you could end up with a lot of included functions!

@philmoz.. look forward to it!
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 469
Modding files
« Reply #8 on: February 16, 2007, 03:48:47 am »

Quote from: piXelatedEmpire
the only draw back i can see is if you have a heavily modified snews.php you could end up with a lot of included functions!
That is the only downfall to this approach. I have not used it much yet since I only have one mod. :D
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Modding files
« Reply #9 on: February 16, 2007, 04:17:23 am »

Quote from: tarmithius13
Quote from: piXelatedEmpire
the only draw back i can see is if you have a heavily modified snews.php you could end up with a lot of included functions!
That is the only downfall to this approach. I have not used it much yet since I only have one mod. :D
Maybe I didn't quite understand what you were referring to in your first post. What I was referring to is... that you can change the name of the snews.php file to any name... no matter how many changes and mods you make to it... as long as you change the name of the file in the include statement at the top of the index.php. Let's say you wanted to clone a copy of snews.php and call it mynews.php... then you would call it into action in the index.php file as:
Quote
// include('snews.php');
  include('mynews.php');
 ?>
In this case, I commented out the include string that would have called snews.php into action... and added a new string to call the new, cloned file... mynews.php.

Of course, you can create any number of php function files... put them all in the root... or in a folder (in the root) called functions.php. Let's say we have a new php file called fatforms.php in the root, and two other php files called sidebartop.php and sidebarbottom.php[/b] located in the functions folder. Then the top of the index.php file would look like this:
Quote
 include('snews.php');
 include('fatforms.php');
 include('functions/sidebartop.php');
 include('functions/sidebarbottom.php');

 ?>
You could have a dozen or 50 or more function files located in different folders. If you had that many... then having 50 include strings at the top of index.php begins to look impractical. So... you would then create a new function file... called functions.php... and include all the include strings within it... then you would just need ONE include string in index.php to call the 50 files into action. Does this make sense? :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

piXelatedEmpire

  • MIA
  • ULTIMATE member
  • ******
  • Karma: 37
  • Posts: 1401
  • currently MIA
Modding files
« Reply #10 on: February 16, 2007, 04:24:03 am »

oh yes, that makes plenty of sense Keys.. and your tip about a functions.php file is a good one, especially if you mod, say, 10 fucntions within sNews... you could then comment out those functions in snews.php (therefore keeping the original code intact), and keep the modded functions in a seperate functions.php file.  This file, functions.php, would then be included within the index.php.

Seems like a good idea to me actually :)
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 469
Modding files
« Reply #11 on: February 16, 2007, 04:29:17 am »

But that is a lot of includes, granted it would be easier to tell what was what, but still a lot files.
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Modding files
« Reply #12 on: February 16, 2007, 04:44:06 am »

Quote from: tarmithius13
But that is a lot of includes, granted it would be easier to tell what was what, but still a lot files.
If you like BIG challenges... try learning how to modify and customize a cms that has 3,646 files in the default package... like phpNuke 7.9... now that's bloated... but it also includes a full-blown version of phpBB as well which is about the most complex free bb system around. I guess we all know why we've grown to like the snews CMS. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 469
Modding files
« Reply #13 on: February 16, 2007, 05:05:01 am »

That is the reason why I got away from all those CMS's out there. I love sNews and have only used it for a week.
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE