SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Apr 23, 2007, 07:28 #1
- Join Date
- Jan 2007
- Location
- Orlando, FL
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DB output display w/ Pagination and Sortable headers. Any tips on abstraction?
Okay, looking for something pretty straightforward, but I want to approach it in a logical direction.
I want a simple output table that will display the columns returned by the query, with each header being clickable to resort the table by that header. I would also like pagination, preferably with variable items per page.
So I know the basics of doing the pagination, and am already doing it on other pages. I can figure out how to dynamically adjust the search query to handle the resorting via the headers. I can do it all piece by piece, and could pretty easily do it all for any given search query.
The issue here is I would love to abstract this so that I can just pass some information to a page/function and have it generate what I need for different queries.
What is the best suggestions for how do do this? Make single page for all of them that calls a function to return the page content?
I am running into an issue with having so many variables here:
base sql statement
sort field
lines per page
header names
mysql fieldnames associated with each header
page title information
How do I get all those variable passed to the display page? I can't post without a form, can I? I can't trust that sessions will be available as the user may have cookies turned off (I am using cookie only sessions elsewhere on the site). I sure don't want to stick a search query in full into the url...
Any suggestions? Am I barking up the wrong tree here?
-
Apr 23, 2007, 08:28 #2
- Join Date
- Feb 2007
- Posts
- 251
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Wrong tree.
PEAR Structures_Datagrid can do all of this and more.
http://pear.php.net/manual/en/packag...s-datagrid.php
-
Apr 23, 2007, 13:34 #3
- Join Date
- Jan 2007
- Location
- Orlando, FL
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Guess I am just not smart enough in php for that yet. All the pear stuff just goes over my head and leaves me confused.
-
Apr 23, 2007, 13:47 #4
- Join Date
- Jun 2004
- Location
- Copenhagen, Denmark
- Posts
- 6,157
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Apr 25, 2007, 07:42 #5
- Join Date
- Feb 2007
- Posts
- 251
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Alluvian! Enough with the self-fulfilling prophecies! You are smart enough. Most definitely.
What specifically are you having problems with? Do you have PEAR installed? Are you able to install the packages, but just don't know how to use them?
Let us know where you're at so we can get you up and running!
It'll be worth it, trust me. PEAR will save you loads of time and many a headache.
-
Apr 25, 2007, 08:20 #6
- Join Date
- Jan 2007
- Location
- Orlando, FL
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have a weird mental block when it comes to using pre-existing software. Like when making my wifes site (in sig) I looked at several options for CMS, but they all baffled me (and didn't seem flexible enough), so I built it from scratch in about a month. It is light on navigation right now so I am fleshing that out.
Anyway, on Pear I am stuck at installation. I am on a shared server running apache (unix), my home systems are all windows xp. I have no login information to access the site through a telnet prompt, and the supposedly easy installation instructions for ftp completely baffle me.
I assume from the pear documentation that I need to be looking under the header:
Installing a local copy of PEAR through ftp/ftps/sftp
at: http://pear.php.net/manual/en/installation.shared.php
But it just starts off with all sorts of requirements that I don't even know what they are much less if I have them.
I doubt I have any of it since all my development has been by transfering files to the live server and testing there. (with different filenames and then renaming for 'launch') I can't seem to get my local server running right. Something in the settings always leads me to broken links and inability to connect to mysql.
It is probably the result of my purely self taught status. I seem to jump into languages and learn the advanced content really quick, but then actually have trouble with not knowing the proper definitions of everything which causes me to falter when trying to read documentation on the expert level content. I mean I can build a pretty decent CMS from scratch in a month but can't figure out how to get a local server working or install pear? That just seems backwards to me. Most of it is I don't know where to start.
Funny thing is I have already written most of the code for the pagination/sort order dynamic page. Annoying that I can write this stuff from scratch faster than I can understand what is handed to me. I really need to get my local server running though.
Site is becoming more popular every week and soon I will be pissing off way too many people when I break it while updating, heh. The adrenaline rush when you miss a semicolon in an include that breaks EVERY page on your domain is sure intense though!!
-
Apr 25, 2007, 13:55 #7
- Join Date
- Jun 2004
- Location
- Copenhagen, Denmark
- Posts
- 6,157
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You don't need to use the PEAR installer to get PEAR libraries. You can manually download the files, and untar them. You'll have to figure out dependencies on your own though (Not that hard, since they are listed in the description of each package).
Not that I'm not a big fan of PEAR, but there you go.
-
Apr 26, 2007, 10:52 #8
- Join Date
- Feb 2007
- Posts
- 251
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hey Alluvian,
First thing I'd recommend is getting that local dev environment set up. It's really easy to do. Let's walk through it real quick...
1) Download XAMPP Lite --
http://www.apachefriends.org/en/xampp-windows.html#646
2) Extract it to your C: drive
3) Run C:\xampplite\xampp-control.exe
4) Stop and restart Apache and MySQL and close the control panel
5) Upgrade PEAR
Open command prompt
cd \xampplite\php
pear channel-update pear.php.net
pear upgrade PEAR
You'll probably get a "commit failed" message.
From http://trac.symfony-project.com/trac...ymfonyWithPear --
Open c:\xampp\php\pear.bat in notepad. Near the middle of the file you will see several lines like this:
ATTRIB +R %PHP_PEAR_BIN_DIR%\pear.bat >nul
ATTRIB +R %PHP_PEAR_BIN_DIR%\peardev.bat >nul
ATTRIB +R %PHP_PEAR_BIN_DIR%\pecl.bat >nul
Put a REM in front of all three commands, save the file and then run the pear upgrade PEAR again.
6) Install Structures_DataGrid
pear install Structures_DataGrid-beta
pear install Structures_DataGrid-beta#datasources
pear install Structures_DataGrid-beta#renderers
7) Read some tutorials
http://www.samalyse.com/code/pear/dgdo/
http://www.samalyse.com/code/pear/linked_grids/
8) Post any other relevant tutorials you find in this thread so that others can save some time too!!
Best wishes,
Denny
-
Apr 26, 2007, 10:54 #9
- Join Date
- Feb 2007
- Posts
- 251
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
P.S. -- The xampplite phpmyadmin can be accessed at http://localhost/phpmyadmin/
Bookmarks