You may remember that not long ago I asked you for some help with objects transfering through $_SESSION in PHP (more: Data loss during sending via $_SESSION from one script to another ). Currently I'm reworking the whole project and I don't have a foggiest idea how to do it properly. I mean, how to do it "according to the art", not "at any cost / the easiest (but nasty) way".
Here's the mockup of what I want to achieve (animated gif):
As you can see, I want my website to display at startup only the navigation, in which I want user to set his starting parameters. In the future, the navigation bar will have ability to be collapsed (to extend the data display section's height). When user sets the parameters (or not - for default view) and clicks "FILTER AND SORT" (which probably will be renamed to "GENERATE"), the second section should appear with data filtered and sorted as user defined.
Data is read from CSV file and stored in PHP Objects defined by my custom classes I've shown you in the question linked above. So I need to communicate data between 5 files:
FRONTEND:
index.php
<-- my main file handling the website
FRONTEND-BACKEND:
navigation.php
<-- file that shall be displayed in the navigation div
data.php
<-- file that shall be displayed in the data section div / iframe (?)
popup.php
<-- file that appears in a div over the index.php when certain DataBox is clicked; handled with tinybox2.
BACKEND:
classes.php
<-- file with definitions of classes (properties and methods)
- tinybox2 "library".
My communication flow is as to be:
navigation.php
displayed on the top of index.php
sends filtering and sorting parameters to data.php
, making it appear on the bottom of index.php
.
data.php
and popup.php
shall use classes contained in classes.php
constructed from CSV file datafile.csv
.
When a DataBox is clicked in data.php
, popup.php
appears over index.php
content to display extended object data.
So, how should I do this, to make it properly? Which option will be best: $_POST, $_SESSION or maybe something else? Maybe due to embeeding all files in / over index.php
it is possible to store all data in such a way, that no communication is needed? How to embeed files - with include, require or maybe other way?
There are lots of assisting questions, but still, the most important is: how to do it properly? Thank you for your help in advance :)
PS For certainty, please find below one additional usecases:
UC1: Standard use of display system
- User enters website with the system
- User chooses parameters for filtering and sorting
- User starts generating view
- Data is being read from *.csv file
- During above, data is being filtered and sorted
- Data is being displayed by the system to the user
Extensions:
5a. No data to display: system displays empty data section
6a. User want's to filter and sort again: back to step 2.
UC2 (OPTIONAL): User wants to share the data
- UC1
- User chooses an option to share data
- System displays question if user wants to send it to printer, or e-mail
- User chooses option (for this case: e-mail)
- System asks for e-mail address
- User provides e-mail address
- System sends an e-mail with the current
data.php
data as it is displayed on website.
PPS I know I should show you some code snippets, but my current code is a mess with lots of interchanging html, php and comments, that cannot be cut of from the system (or would take me ages to clean it up to show it here). I'm asking you for help mostly, because I really want to remodel the current solution, therefore I'm rewriting the code from zero, using old one as a hint, not a template. Like Microsoft did with Windows Vista and Windows 7 :P Hope you'd understand ^^'