I am looking for some advice or at least get an idea on how more experienced programmers approach building a site from the ground up.
I realize that this is a pretty broad question, but I'm trying to establish a somewhat linear approach from start to finish. After having a well designed database built what are the general steps you would take to jump off?
For instance, there are things that are going to be universal across the site...
- database connection
- session management
- security
- site navigation/header/footer
- mail
- css
My school of thought says create several include files that have unique functions and include them all in one file named say...'functions.inc.php'. One for security that contains necessary functions, another for session management, another that has code that collects links from the database and spits them out, etc. Then include the 'functions.php.inc' in every page that is created.
This way all the similar functions are kept together in seperate files and accessible thoughout the entire site. Now that the 'framework' is set up, all pages with unique functionality will pull their content from includes that contain functions specific to them.
I'd like to hear what others think of this method and what things I might be missing when it comes to the list of 'universal' functionalities I listed above. Plus, methods others use for this process.
Thanks for any input,
Rob
steps to create website
Moderator: General Moderators
Well i think u had done a lot research on the web application.
U can make the templete of html so that u can use the templete in the ur web application,Once u had managed the database the rest is upto ur creation and imagine power,so be confidient and start programming
Bcoz.Programming is the best work of thiss world
U can make the templete of html so that u can use the templete in the ur web application,Once u had managed the database the rest is upto ur creation and imagine power,so be confidient and start programming
Bcoz.Programming is the best work of thiss world
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
-
mahara
- Forum Commoner
- Posts: 37
- Joined: Wed Nov 13, 2002 1:08 am
- Location: Bandung, Jawa Barat, Indonesia
I think this is a very interesting topic.
For me, building a website it's not only talking about the way you program your code (make your script logically right and works); I think the most important thing is the architecture. A well-defined architecture theoritically makes you easy to program your code, fix problem when occurs effectively, and a lot more of advantages I think. As a beginner, I'm continuously searching for better one that still possible for me to implement. I wish that someone could tell me a better way than mine.
In my project, I use PHP (4.3.4) for making dynamic content, MySQL (4.0.17) as backend DB, and also HTML (4.01) and DHTML (VBScript or Javascript) for rendering the page.
In the way I program, I try to use an approachment of OOP (Object Oriented Programming) -- though it can't be fully implemented in PHP4 -- because it makes me easy to implement and understand the code.
There are some basic classes that I construct.
- configuration, as a provider for system configuration
- DB, works as data provider layer
- language, provides basic multi-languages support for users
- template, layer for separating between layout and code
- user, of course to maintain user (user level and status) and session (logging activity)
- page, support some basic functions for page creation (including navigation), which can also control what level of user that can take control to a specific page.
And finally, through the help of those basic classes, I can implement my code easily because some basic routines have been automatically done.
That's what I've done and it works for me.
For me, building a website it's not only talking about the way you program your code (make your script logically right and works); I think the most important thing is the architecture. A well-defined architecture theoritically makes you easy to program your code, fix problem when occurs effectively, and a lot more of advantages I think. As a beginner, I'm continuously searching for better one that still possible for me to implement. I wish that someone could tell me a better way than mine.
In my project, I use PHP (4.3.4) for making dynamic content, MySQL (4.0.17) as backend DB, and also HTML (4.01) and DHTML (VBScript or Javascript) for rendering the page.
In the way I program, I try to use an approachment of OOP (Object Oriented Programming) -- though it can't be fully implemented in PHP4 -- because it makes me easy to implement and understand the code.
There are some basic classes that I construct.
- configuration, as a provider for system configuration
- DB, works as data provider layer
- language, provides basic multi-languages support for users
- template, layer for separating between layout and code
- user, of course to maintain user (user level and status) and session (logging activity)
- page, support some basic functions for page creation (including navigation), which can also control what level of user that can take control to a specific page.
And finally, through the help of those basic classes, I can implement my code easily because some basic routines have been automatically done.
That's what I've done and it works for me.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
There is a school of thought which recommends test-code-design rather than design-code-test.LiLpunkSkateR wrote:I believe if you just start coding without actually thinking out what you're program is going to do (and how you're going to do that), it will turn out like a mess and its just harder to fix things in the future.
Before you get to the code it can help to create a storyboard, ie a plan of how users & admins etc will interact with each page on the site. It might be useful to create a mock-up with static html - pencil & paper will do just as well.
Planning out a common functions library is a good idea. Anywhere you find repeated code - or repeated patterns in the code - should trigger an alarm bell.
For anything more complex than "hello world" I'd almost certainly be using OOP.
Often each page model is built by aggregating sub-models per page layout block (header, sidebar, main content etc). It's good if you can share items like the header or a nav sidebar, or print the same block models in different templates on different pages. Be careful to separate models & views.
-
mahara
- Forum Commoner
- Posts: 37
- Joined: Wed Nov 13, 2002 1:08 am
- Location: Bandung, Jawa Barat, Indonesia
Did I mentioned before DHTML? Of course it's currently supported only by IE. I'm sure 80% of my viewer's targets use IE. I have to implement in that way because other browsers still not supporting features included in DHTML; sometimes Javascript lacks of dynamic browser rendering. Due to other 20%, I have to still support them through Javascript, with limited capability.LiLpunkSkateR wrote: VBScript = IE only.. correct?
If you can help me find other browsers which can render effects such as color gradient, shadows, etc. or maybe complex flyout menu (pure HTML of course, without using Flash) -- like one in DXImageTransform --, I would gladly thank to you.
You may say so, but sometimes I still found people do like that; I mean they still do with a little consideration about it.LiLpunkSkateR wrote: I believe if you just start coding without actually thinking out what you're program is going to do (and how you're going to do that), it will turn out like a mess and its just harder to fix things in the future.
BTW, I just wanna share the way I do, just like the topic's starter said.