Building a Site Engine with PHP, Part 5 - Plug it in, Plug it in! (
Page 2 of 5 )
Once you’ve got a GUI for MySQL (unless you plan on going all out commando with it and using the command line), you can start with your plug-ins. Since everything depends on the plug-ins, I’d say you have to start with the plug-ins, but it is your choice.
In the database there are two tables for the plug-ins -- the plugins table and the plugin_status table:
- The plugins table contains all the information about where the plug-ins are located, their ID’s, what they are named and their loading priority. It also has a few optional fields that contain the author’s name and the plug-in’s version.
- The plugin_status table only contains two fields, neither of which is optional. The first one is the plugin_ID which corresponds to the plugin_ID in the plugins table, and the plugin_status field. The plug-in_status field is one of two values, “initialized” or “not_initialized”. These values tell the plug-in loader to either load the plug-in or not to load it.
The first thing you need to do when installing a plug-in is name it in the plugin_name field in the database; it can be anything you want it to be. The name of the plug-ins has nothing to do with the functionality of the site engine at all; it’s only for your personal reference. Then put in the name of the directory that the folder for the plug-in can be found in. If you followed the suggested directory structure outlined in article three, you’d put “plugins” in this field named plugin_dir. Then you need to put the name of the plug-in’s folder in the plugin_file field; for simplicity sake we just use the name of the folder that contains the plug-in as the plug-in file. If you remember back to the second article, we did this because it’s better for organizing and loading the plug-ins and we just names the PHP file for the plug-in main.plug.php. After that you have the plugin_priority field, this tells the engine if there’s any plug-ins that need to be loaded before others. The higher the number, the sooner it’s loaded.
For example if you have plugin1 with a priority of 0, plugin2 with a priority of 2, and plugin3 with a priority of 1, they will be loaded in the following order.
plugin2
plugin3
plugin1
As for the plugin_author, you can put in your name, or the name of the person that made the plug-in, or you can be like me and completely leave it blank. You can do the same thing for the plugin_version field.
In the plugin_status table, you have to add a row that contains the plugin_ID that is the same as the plugin_ID in the plugins table, which is auto incremented when you add your new plug-in. Then you have to tell it to either set the plug-in as initialized or not_initialized in the plugin_status field. Keep in mind if you set it to “not_initialized” the engine will not load it.
| | Discuss Building a Site Engine with PHP, Part 5 | | | | | | | great articles... thanks :) | | | | | | Thank you for the articles!
My question is: why it is necessary to have a... | | | | | | it would still be very helpful to me if a complete directory structure of a working... | | | | | | If anyone has gotten this to somewhat work. (ie knows which files should go where)... | | | | | | i'm taking a very good look at it and i almost have it up and running...
i'll keep... | | | | | | I was thinking of designing something very similar but I'm working backward. I... | | | | | | I read just the first article. I didn't read the rest 4 just because:
1) they were... | | | | | | Just copy and paste the code from here into your favorite editor (Crimson Editor),... | | | | | | I wouldn't call comments 'breaking up the code', quite the opposite, they make it... | | | | | | Yeah really, its not that hard to do. ;) | | | | | | I too have gotten most of it to work. The only thing I am still struggling with is... | | | | | | ok for the people who like to have a zip package with a working version how i see... | | | | | | damn... link formatting wont work >(
well here goes for the sql... | | | | | | scroll down :) | | | | | | Thats great! Thanks.
I see you have not used any of the modules though im still... | | | | | | Link formatting works if you are logged in. You can create a free blog account. It... | | | | | | yes i was looking for that too... where can a do that? | | | | | | i didnt have the time to look at the module system.
i'm not sure how they suppose... | | | | | | You can create your fee blog account... | | | | | | i've got it al working now, but i have one question.
How can I make a difference... | | | | | | I think this article is for beginners php.........
but its good overall | | | | | | when you make an instance of the site class, it looks if the page var is set.
You... | | | | | | but, this is my blcok_location table:
bl_ID block_ID block_row block_col ... | | | | | | in the [color=red]SITE_ROOT\plugins\blocks\main.plug.php[/color] find the... | | | | | | That's great!
I really couldn't understand that piece of code and i knew Jaimz... | | | | | | I get a few notices (
Notice: Array to string conversion in... | | | | | | The exact same thing happens for me. Regardless of what I set the page variable as,... | | | | | | you need to change you php.ini so that it does not report notices (search for error... | | | | | | struggling with this PHP thing, tried your package and got the following... | | | | | |
Hello
I am not php programmer, but I have been motivated by these great... | | | | | | output your SQL string to the screen and look for wrong SQL parts. Probably there is... | | | | | | for the php4 conversion, look at the discussion of the previous parts of this... | | | | | | i'm happy i just made this system work and it looks good ... but i have a few... | | | | | | everythign is controlled via the database, depending on what PAGE and what SITE... | | | | | | ok... and how about the first question.? | | | | | | let's say i have a link on my main page - "News". how do i do the... | | | | | | Nice article! | | | | | | Same problem for me too.. I've looked at it for 1 hour or so, it seems correct...... | | | | | | i'm having the same problem? did anyone find a solution yet? | | | | | | i've found a temporary solution, and i don't know if it's the best one. in... | | | | | | ok... everything is working nice and smooth... but i have a question. does anyone... | | | | | | Thanks for the superb articles! Great work indeed :)
Ok, so now I've begun to... | | | | | | Hehe, yeah, that works :) but the moment you want to do a page that only some users... | | | | | | Sorry I meant parentheses not comas :)
Btw, great articles! Helped me a lot in my... | | | | | | um, there is no "wrong" way of doing anything Jaimz provided everyone with a... | | | | | | hi,
i have problem with CURRENT TEMPLATE
if i want different template for each... | | | | | | good | | | | | | Don't get me wrong this is a very useful article which is almost exactly the same... | | | | | | replace your dbhost, dbuser, dbpass and dbname in config.inc.php with your database... | | | | | | replace your dbhost, dbuser, dbpass and dbname in config.inc.php with your database... | | | | | | libxml2-2.6.13-1.i386.rpm
libxml2-devel-2.6.13-1.i386.rpm
install both of em adn... | | | | | | I really liked the article series, it is a good starting point for building a site... | | | | | | Hi,
your articles are really very good for newbie PHP programmers trying to... | | | | | | I saved the auth, blocks and templates files as includes which is more logical... | | | | | | this type of engine is being used on a high-traffic production server. dont doubt... | | | | | | um your not understanding how this engine works, you define what pages the blocks... | | | | | | Help me please! It is possible to give an example operations on such site of the... | | | | | | Hey Jefrey,
This link is not accessible anymore, coul dyou please make the file... | | | | | | Thanks for the articles it has been an interesting read.
To my knowledge and I... | | | | | | Hi,
are these two files aviable somewhere to download? The original sourc is... | | | | | | Forgive for, probably, silly question.
For example, I have a class gallery and... | | | | | | this code doesnt work i allways get a mysql connection error and the php files are... | | | | | | The tutorial is meant as a base to work out from. you need to think out the rest for... | | | | | | I registred member but I cant download the script.
Somebody please send me this... | | | | | | Authors who are confident in their subject and what they have written usually post... | | | | | | Does anyone still have a copy of the source in a zip file for this? | | | | | | Sure. Why does someone write an article anyway? Some people simply build code and... | | | | | | If 10 people read this article and attempted to build the source code, you'd have 10... | | | | | | I think, that sources must exists! 'cause the article is not so full to show the... | | | | | | I agree that the point of this article was to teach and not provide a download for... | | | | | | umm.. this article is YEARS old.. and back when i first found it, it didnt take me... | | | | | | I've read through all five articles and really appreciate the effort the OP put in... | | | | | | Hopefully some one still reads these discussions about the site engine :) The idea... | | | | | | When you ask about the 'main.plugin.php' file, I am thinking that you may not be... | | | | | | Hi everyone,
I apologize for being too late with this post. I have just found... | | | | | | Yeah,
I would also like to encourage James to update and continue this article... | | | | | | >>> Post your comment now! | | | | | |
|
 |
|