[Ajax Fail] PHP Loading page way
Posted: Wed Jul 24, 2013 5:50 pm
Hello everybody. I'm working at my CMS platform, and recently I tried with a friend to implement pages with ajax and jquery. First thing was to do navigation from one page to another , with a nice effect. Anyway, let me explain what's the problem.
This platform, is based on index.php file, everything is there, including files, database connection and global variables like $x and also a file called template.inc.php where it loading the entire template and at content div, page asked in url.
Here is a screenshot :http://postimg.org/image/8knhwc1tj/
And here you can see how template "engine" is working: http://postimg.org/image/inngdfitv/
So, my url is: index.php?pag=FOLDER&sub=PHP_FILE¶m1= etc
Let's take "AdminPanel" theme:
So, If I want php file "settings" from "account" folder (module) , I open this link: index.php?pag=account&sub=settings . Entire content of settings.php will be in AdminPanel theme because how you can see, I include it there. But, this theme is called by template.inc.php so, everything is from index.php , and when I try to do something in jquery, example, to load page instantly without refresh, I have to reload the entire page ( index.php?pag= etc) , so, is not an option . Is here a really problem? Is no way to do this If I load pages using $_GET ?
Is very important this organization because I'm going to create modules management and more, and what I want to know exactly, if this is a really wrong abordation for jquery/ajax , if there is no way to use jquery on this type of templating.
This platform, is based on index.php file, everything is there, including files, database connection and global variables like $x and also a file called template.inc.php where it loading the entire template and at content div, page asked in url.
Here is a screenshot :http://postimg.org/image/8knhwc1tj/
And here you can see how template "engine" is working: http://postimg.org/image/inngdfitv/
So, my url is: index.php?pag=FOLDER&sub=PHP_FILE¶m1= etc
Let's take "AdminPanel" theme:
Code: Select all
<html>
<head>
<title> Test Theme</title>
</head>
<body>
<?php
if(file_exists("app/Modules/$pag/$sub.php")) {
include("app/Modules/$pag/$sub.php");
}else{
include("app/Modules/dashboard/dashboard.php");
}
?>
</body>
</html>
Is very important this organization because I'm going to create modules management and more, and what I want to know exactly, if this is a really wrong abordation for jquery/ajax , if there is no way to use jquery on this type of templating.