Welcome! Log In Create A New Profile

Advanced

My own framework

Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar My own framework
April 13, 2013 01:34AM
I am attempting and writing my own mini PHP MVC framework and want to know if using this for the project would be an issue as the file locations and names would be a bit different. It will by no means be as good as the mainstream frameworks but it is proving quite challenging, fun and informative to write. I have learned a lot so far.

If I just did the project as it is there with those few files then it would not be a challenge at all. I wanted to risk it but decided to ask before I use it and wanted to know if there might be any extra "credit" in it if I pull this off? Or am I allowed to do this at all? I can't see why not, it is a very rich learning experience. smile

----------------------------------------------------------------------------------------

int get_random_number() {
return 4;
}
avatar
Mac
Re: My own framework
April 15, 2013 07:48AM
As long as it is in all parts your own MVC
avatar Re: My own framework
April 15, 2013 09:43AM
Hi,

Yes it is, spent quite a bit of time on it. The routing and getting everything loaded was the hardest part so far. I don't know how to handle the views yet and might just be able to make something small for it. I might also not have time to add a database abstraction layer so the queries will be in the models.

Going good so far, I'm very excited!! thumbs up smiley

----------------------------------------------------------------------------------------

int get_random_number() {
return 4;
}
avatar Re: My own framework
April 18, 2013 12:41PM
Hello,

After the assignment 1 results I have decided to not use my framework and will be doing the easy and low risk one. sad smiley
Too afraid of going outside requirements and loosing marks. Last thing I want is to redo a module.

----------------------------------------------------------------------------------------

int get_random_number() {
return 4;
}
Re: My own framework
April 19, 2013 07:49AM
Mac, would this be the case?

Is it best to be more critical of the spec as in the first assignment...
As my site was going well and fast but after I had 22php pages I realised I was doing something wrong...
Petrus mentioned writing his own framework and I attempted using a Player and Fixture class, but the more I got into it the more Tech it got,
and well looks like only way to do it is sort of write a framework (mine will be very basic however)
but I am doing this to learn.... what is best to pass the module? should I still rather hand in a page without a class?

then, if the Class/framework is ok... I need help spinning smiley sticking its tongue out

when it comes to views...
I have my basic index page and then I include the DATA/divs etc depending on a action...
now if I have 3 divs on the page.... should I just create 3 variables that I can change the data in?
Do I create 3 different views that includes the bulk of page (and doubling u up on code?)

little confused as to what is best practice or what will work, (is easy now as I only have one view working)
avatar
Mac
Re: My own framework
April 19, 2013 08:45AM
It is difficult to say because I do not want to thwart innovative uses of classes that point at advanced logic.

So you can use classes if you want. Generally, I get concerned when all code on a single page is a complete class where you just specified the connection details. So make use of classes, but together with your own code.
avatar Re: My own framework
April 19, 2013 09:39AM
This is good news smile

I have more than one class, what I did was use a .htaccess file to route all my requests to index.php. From there I store the url and send it to a "boostrap" that loads everything needed like config file and base classes' files. After that it looks at what was requested and loads those files, creates an instance of that class and then if there was an action specified it executes that method, otherwise it executes a default method called index that is in every class. There is just a few files to achieve this, index.php, config.php, boostrap.php and then the files containing the base classes controller.php and model.php.

If I create a page in it, I would, for example, create a controller named maincontroller.php, a model for it called mainmodel.php and then still have to figure out how I will be loading the views.

I am going to put a basic project together just for incase I don't get to finish this so that I have something to give in on the due date. Still have 4 other modules that need some attention.

----------------------------------------------------------------------------------------

int get_random_number() {
return 4;
}
Re: My own framework
April 19, 2013 11:46AM
wow, sounds like yours is awesome...
I am struggling to get mine together,
but don't think mine will be nearly as good as yours, think Mac (and you) will cringe if you see what I am doing.
hopefully I can get it together, sure once I have concept sorted it will move allot faster.
Re: My own framework
April 23, 2013 08:04AM
Regarding the links to my PHP code,
this becomes a little tricky when dealing with framework (maybe just my framework?)
not sure if it will be ok to have a mycode page.... that has links to the code for the different pages, or...(if I can figure it out) have a download zip file?

I can add the links all relevant links for the respective page i.e. all views used on page and the controller and the class link.....?
not sure if that would be better?
Sorry, only registered users may post in this forum.

Click here to login