Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 2 [3] 4

Author Topic: split snews , more customizable ,install mods easier  (Read 21273 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4957
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
split snews , more customizable ,install mods easier
« Reply #30 on: May 03, 2007, 11:22:36 AM »

Even though you say your kidding... I don't think you should go about doing your own open source project named mNews... I think if you start this, eventually when time permits, do it here... I'm sure there will be people offering their help once you started...

Even though the base script, sNews, is the lightest, simplest, fastest CMS around, and that the main engine is this onefile system, there is nothing preventing the forum members to create some other branches of sNews, such as Bob's MUsNews... (Multiuser version)... Your idea, would certainly attract many people, although not the core population of sNews dudes, that think the first and best idea, is the one to persue...

Thing is that the sole script is made for ease, and simplicity when doing a website... All discussions of modding comes when you know more things (which is not the most common thing... it's just that we, that have this demand, seem to be more visible, right...) and becomes interesting as we do want to add nifty things, but the common user don't need to add these things, but uses sNews only for what it's intended from the start... An easy way of putting up news on the web.

This meaning that this script (the on file "simple" snews) is what is being developed and improved upon all the time. Do a part of the community want another "branch" it's great, but not fully supported by the sNews developers as they focus on the single file mainly...

Oh, I'm rambling, and I'm not sure I say what I'm thinking, but I mean well ;)
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 105
    • http://ght.ir
split snews , more customizable ,install mods easier
« Reply #31 on: May 03, 2007, 02:08:02 PM »

Dear Patric
branching is a good idea.But I'm in a course of military services in my country and I have No Time unfortunately.
I think sNews is a very good base for a very good cms, I saw phpnuke,joomla,wordpress,movable type and ,,,,
the best thing around sNews is power near simplicity! I can memorize all codes to do my job best. I can mastar on code and do what I want,I have to many ideas but unfortunately no time to do :(
I think you must start a tracking system sooner (like trac : http://trac.edgewall.com that I mentioned before) , then good programmers comes here to improve the power with Mods. I think the main engine must be as simple as is, and the power is based on sNews Mods...Like linux core and to many based on linux applications,Like Firefox and to many powerfull extensions. Like sNews and too many Mods in future ;)
Logged
Be A Color Pencil For Painting The World !

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4957
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
split snews , more customizable ,install mods easier
« Reply #32 on: May 03, 2007, 02:19:42 PM »

Yupp, I think that is what I'm saying aswell...
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

Keyrocks

  • Doug
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 451
  • Posts: 6262
  • Semantically Challenged
    • snews.ca
split snews , more customizable ,install mods easier
« Reply #33 on: May 03, 2007, 02:44:15 PM »

I see this as a good discussion. As Agentsmith pointed out a few posts up, several of us have different ideas on how we want to use sNews... site types, added functionality, ease of use for end-users, etc. What we have to remember is that sNews is relatively "new" to most of us as a CMS. I've only been working with it for i year... and I'm still here and working with it because it is a simple system and it has helped me learn to use PHP a lot more than I did at first.

We sNews Dudes continue to 'preach' the principle of keeping sNews in its current simple platform, but I  am looking for a way to add other features in a modular fashion without altering the core snews.php file very much. At this point, I keep adding my ideas to my "to-do" list. But I still haven't settled on how to approach this task. I want to give it enough thought so I can end up with a fairly flexible approach without having to change direcction mid-stream. Eventually... at least for me... a 'bright light' will flash on in my head and that's when I'll get started on it. And... if someone else gets started on it before me, all the better. The key is to share it here to advance the sNews project.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
split snews , more customizable ,install mods easier
« Reply #34 on: May 03, 2007, 06:15:57 PM »

Here's something that I've been doing lately, when making mods:

I've added a directory named "mods".  Then I create the mod in a file named the SAME as the function name.  So if I made a mod to the archive() function, I name the mod file archive.php and save it in the mod directory.

I added a variable into the db varibles
Quote
$db['modpath'] = 'mods/'; // name of mods folder make to include the "/" at the end
Within the archive function in the snews.php file, I've added some additional code to the VERY beginning of the function:
Quote
function archive() {
   if (file_exists(db('modpath').'archive.php')) { include(db('modpath').'archive.php'); }
   else {

   echo '<h2>'.l('archive').'</h2>';
then an extra } at the end of the function.

What this does is checks the "mods" directory for a file named "archive.php", if it DOES exists, it includes the "archive.php" code and ignores the default archive() function.  If it DOES NOT exist, it uses the default archive() function.

This is not a perfect solution, but it definitely helps with avoiding editing too much of the sNews engine.
« Last Edit: April 18, 2008, 05:53:16 PM by bakercad »
Logged

tarmithius13

  • Sr. Member
  • ****
  • Karma: 7
  • Posts: 476
split snews , more customizable ,install mods easier
« Reply #35 on: May 03, 2007, 06:54:35 PM »

Baker that is excellent, I did not think of doing that. And if you remove the mod it will affect anything since it will just revert back to the original. Brilliant!!!!
Logged
The trick to flying is to throw yourself at the ground and miss.

Free sNews templates HERE

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 105
    • http://ght.ir
split snews , more customizable ,install mods easier
« Reply #36 on: May 03, 2007, 07:33:58 PM »

Good job bakercad
but there is the same problem...,how we can split the mods from the main engine?
I love sNews because it split design and code.I write some code that I named it language_select function and I switch between tow language easily! it's because of splitting design and code.
I think a new cms that has 3 units that are accomplish with each other but they are act separately that changing one unit has no effect to another parts:

1)Main engine (only snews main engine)
2)Design engine(only css and index.php file)
3)Extension (Mod) Engine (that add mods)

I'm speaking about some new branch of sNews.
Logged
Be A Color Pencil For Painting The World !

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
split snews , more customizable ,install mods easier
« Reply #37 on: May 03, 2007, 10:10:53 PM »

Thanks guys

@ght...I understand what you're looking for and agree with keyrocks, Patric and others.  Like I said, my solution is not perfect, but it's useful to me and I think it could be to others.
Logged

piXelatedEmpire

  • MIA
  • Thread Moderator
  • ULTIMATE member
  • *****
  • Karma: 37
  • Posts: 1454
  • currently MIA
split snews , more customizable ,install mods easier
« Reply #38 on: May 04, 2007, 01:51:29 AM »

wow baker that is a terrific solution! The only cath I can see if if you need to MOD several function for several different MODS, the overlapping of MODded function files.

Still, it leaves the core relatively untouched.  I think I'm going to employ this approach for future projects! Cheers! :D
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 105
    • http://ght.ir
split snews , more customizable ,install mods easier
« Reply #39 on: May 04, 2007, 02:59:39 PM »

let think about bakercad solution, Is it possible to add in each function such trick?
Logged
Be A Color Pencil For Painting The World !

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
split snews , more customizable ,install mods easier
« Reply #40 on: May 04, 2007, 03:06:01 PM »

Quote from: ght
let think about bakercad solution, Is it possible to add in each function such trick?
Yes, you can definitely add this for each function.  Though with the language variables [l() function] instead of using the else part of the statement, you can use the if part only.  That way the existing variables are used and an addition language variables can be pulled from the language file in the mods folder.
Logged

Keyrocks

  • Doug
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 451
  • Posts: 6262
  • Semantically Challenged
    • snews.ca
split snews , more customizable ,install mods easier
« Reply #41 on: May 04, 2007, 03:16:21 PM »

Quote from: ght
let think about bakercad solution, Is it possible to add in each function such trick?
(saying the same thing in a different way...)

You can use Bakercad's solution (post #35) in any function within snews.php. Its purpose is to cause a new function of the same name in a new file (in his mods folder) to override the existing function... or allow the existing function to operate if the new function file does not exist. So, with this in mind, you could leave the override string(s) in the existing function and take the override function file out of the mods folder and the existing function will still operate.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 105
    • http://ght.ir
split snews , more customizable ,install mods easier
« Reply #42 on: May 04, 2007, 05:06:29 PM »

bakercad solution is improved in this way :

Mod_Grabber mod :D
-----------------------
1) add a table of mods with these fields:
               A)name    B)author  C)information     D)version E)active

sample data :  archive - bakercad - bakercad's mod -   1.0      - YES

2)add this function to the core :

function mods($variable) {
$mod_active = retrieve('active', 'mods', 'name', $variable);
if (file_exists(db('modpath').$variable.'.php') && $mod_active=='YES')

{ include(db('modpath').$variable'.php');
  return true;
}
    else {
  return false;
}

3)add a section in "administration" in the "site" section below the "Setting" that has name : "Mods"
you should add mods in this variable too.
$l['cat_listSEF'] = 'home,archive,contact,sitemap,rss,login,administration,admin_category,admin_article,article_new,extra_new,page_new,categories,articles,extra_contents,pages,settings,files,logout';
you should write a functions to grab all mods from mod directory.and show in this section and a link to active/deactive each mod.

4)in each function you must do what bakercad did. with this change:

function archive() {
    if (!mods ('archive'))
    {
    echo '

'.l('archive').'

';
    }
}


BUT THE MAIN PROBLEM:

mods in general change multiple functions.this is very important consideration in mod management section.
bakercad's solution only consider such mods that only deal with one function.yes it's really easy to change one function with an external php file.but the main problem is designing an architecture that will be independent from the core.there will be conflicts if we don't consider this problem.change each function leads to errors in to many another mods.(it's similar to linux package dependencies!)

A WEAK SOLUTION -Second type of Mods:Plugins
I suggest a weak solution,we have an external php function for each basic function and if any plugin change some function you must change that function in that external file (and don't change the core)
I mean plugins have a shared directory of external functions of main sNews core and if you want to change each function of sNews you must change or create that function in mods directory.if there is not an external function (like archive.php) sNews uses it's original function,but if there is,sNews use that external.

Now when you write a new plugin you must only mention which sections of each function must be changed.the shared mod directory is for this changes.

for example you wrote a plugin with this name : print_friendly

1)this function change functions a,b,c,d.

2)in mods directory you create/change a.php, b.php, c.php, d.php (change when another plugin use the modified a or be or c or d function,create when for the first time this plugin use a modified version)

3)in plugin directory (directory that has print_friendly.php) you create a directory for each plugin to make what you want with this plugins (for example you want use a css,some images and...all connections is handled by print_friendly.php)

4)there will be a plugin management section for active/deactive and ..., and when you deactive it you must manually change external functions.

it maybe there was such errors in my writings and codes and it because when I was writing this post I was in hurry!I hope you understand what I said ;)
Logged
Be A Color Pencil For Painting The World !

bakercad

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 105
  • Posts: 1670
    • http://exit20.com
split snews , more customizable ,install mods easier
« Reply #43 on: May 04, 2007, 05:40:15 PM »

Quote from: ght
bakercad's solution only consider such mods that only deal with one function
My thought is to make a snews.php file where the if/else statement exists for ALL functions.  That way if multiple functions are effected, adding the mod would mean, downloading a zip file with the new php files and dropping them in the mods directory.....mod added without touching any code.  HOWEVER!!  This WILL interfere with other mods, as you states as well, so we need to me carefull about doing it this way.

Your idea of adding the table is a fine idea as well.
Logged

mofey

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
split snews , more customizable ,install mods easier
« Reply #44 on: May 15, 2007, 11:53:31 PM »

Why you don't want sNews to be a new Wordpress?
What do you want it to be? A Joomla-in-one-file?

I think there needs to be an easy way to install mods. This is a very important feature and is very popular among different projects actually.
Logged
Pages: 1 2 [3] 4