Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 994 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Building cms for my bachelor degree and need some advice

#1
I'm currently starting to write my own CMS in php from ground up using CakePHP (or should i use something else?) for my bachelors degree. And i'm thinking about various stuff that will be needed to do.

One of the things i can not figure out is if i should use a single file (for example, index.php will handle everything, and will include everything) or i should break up my cms into a few smaller files.

so my main questions are

* is cakePHP a good choice?
* use one file for everything or use multiple files?
* do you have any good general advice on building more complex websites using php or any best-practices advice (i don't really understand why they don't teach us this in school)
Reply

#2
Using a single file "entry point" gives you more flexibility when it comes to routing requests to various logic - you'll only ever have to worry about filtering one spot in a request chain.
Reply

#3
These are really subjective questions.

I, once, wrote a CMS in php from ground up for my 3rd year project.

What I did was basically:

- Checking how other people did it ([Plume CMS][1] and [CMSmadesimple][2] were a good start)
- I didn't use any framework (that was a requirement)
- and Yes, I used index.php with multiple params to handle different pages.

[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#4
Using a single entry point or multiple entry points becomes a moot point if you are using most frameworks. CakePHP for instance has an index.php file and all you end up doing is defining models, views, and controllers for different parts of your project. I would imagine that most frameworks these days work this way.

Alternatively, if you choose to roll your own framework and system for managing this, which given this is for a bachelor's degree may be (1) a lot of extra work but (2) more revealing and more instructive, I can speak from experience that I found having a single entry point to be useful.

1. It enables you to have a common code path for set-up stuff: things like enabling E_STRICT, E_NOTICE, etc. for debugging and reliability purposes. Things like sanitizing form inputs to work around the magic-quotes setting. Yes you can do that from an `include 'globals.php'` but:

2. Putting everything in one place also lets you come up with a standard file-naming convention and an `__autoload` handler that will help remove any `include` or `require` directives except for perhaps one. Means you can add classes and such without having to also remember to update a master file.

3. And this is entirely subjective, but I have found that it's easier to create simpler URLs using this. Instead of `/volunteers/communities.php?id=Hedrick_Summit` I can do `/volunteers/communities/Hedrick_Summit` which is more pleasing to me.

As for the choice of CakePHP, I have briefly toyed around with that framework. What I don't like about frameworks in general is they often have to be _too_ general, to the point it results in extra cruft and slower page rendering. And the moment you have to do something that pushes the boundaries of the framework, _and you will_, you end up fighting the framework.

But to be fair, CakePHP seems to be adequate and generally well-designed. I personally took issue with the ORM layer but that was me striving for perfection and actually trying to do work in the SQL query. It has a reputation for being slow, but unless you're trying to build the next Facebook you should be fine.
Reply

#5
Answer is yes use multiple files in multiple directories, it makes all difference in the world when you need to debug or scale.
Reply

#6
I would advise you to keep in mind the [MVC][1] (Model-View-Controller) pattern.
It is one of the most commonly used (and often misused) patterns in the CMS field.

Also, don't be afraid about looking what other people are doing. Read the code from Joomla, Drupal and other open source CMS. Have a look to **language different from PHP** to have a comprehensive glance about the possibilities.

Don't try to simply re-invent the wheel. Even if this is simply a Uni assignment, try to put something new on your CMS. Something that would push me to use yours instead of other CMS.


[1]:

[To see links please register here]

Reply

#7
> is cakePHP a good choice?

That's a highly subjective question and as such unanswerable. Though, if you want to experiment with architecture (eg. compare front controllers to page controllers), you probably should build more from scratch, as a lot of those decisions have already been made by the writers of said framework (And a lot of other frameworks, for the matter).

> use one file for everything or use multiple files?

It's called a front controller (single entrypoint) or page controllers (multiple entry points). Get a copy of *Patterns of Enterprise Application Architecture* by M. Fowler.

> do you have any good general advice on building more complex websites using php or any best-practices advice (i don't really understand why they don't teach us this in school)

There are billions of CMS's. Find some of them and analyse them to find out what they did and how they differ from each other. Trying to categorise the different approaches and compare their strenghts/weaknesses could make for a good paper.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through