Jump to content

Web App Best Practices


imperium2335

Recommended Posts

Hi,

 

I am developing a large management/CRM system for my company.

 

I would like to hear your thoughts on what is the best way to organise functions and files.

 

I know of a few ways:

 

1. having all your PHP at the start of each page which fetches all the data from the DB and then echo it out into the right places in that page, e.g. fetching a list of options then later echoing out the option data into a 'select' tag, creating a dynamic list.

 

2. Have the majority of the PHP completely seperate from the page in a seperate page, and you INCLUDE that at the start of your html page.

 

3. Have many seperate PHP files that do different bits for that page, e.g. one php file is for fetching a list of sales contacts, another for fetching enquiries numbers etc and have it all injecting into the correct containers on your page using Jquery and AJAX, which lets you have dynamic updates if you stick them in a setInterval loop.

 

4. This is the one I most fancy. You have one PHP file that has several 'modes'. Now when you call it in an AJAX statement, you pass a mode variable to it which is the condition for one of the IFs in your PHP files. So if I wanted to fetch an up to date contact list every x seconds, I would also pass a variable like 'FETCH_CONTACTS' i.e.:

$.post('record-control.php', {targetCustomer:thidId, mode:'FETCH_CONTACTS'}, function(data){$('#targetDiv').html(data)}) ;

 

Which way would you prefer if it was you?

Link to comment
https://forums.phpfreaks.com/topic/251822-web-app-best-practices/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.