The website I am developing is structured like this:
It has a function that switches the module for the contents of the home page when installed $_GET['module'], for example:
function switchmodules()
{
$module=$_GET['module'];
switch($module)
{
case 'getnews': news(); break;
default: def();
}
}
As you can see, this switch calls a different function for each module.
For example, I wrote getNews()to work this way:
function getNews()
{
$id=$_GET['id'];
if(!id)
{
}
if(isset($id))
{
}
}
So, as you can see, I do not use a unique file for each module; all module operations are part of a unique function in which the action switches again to change the result.
If I want to receive news from the database, I have to use the following URL: ?index.php&module=getnews&id=1
:
jQuery $.ajax() (), , get? ?