I have a spreadsheet created in Numbers that I wold like to include on my website using text so it can be searched/ Currently I have PDFs but they aren’t searchable.
Try saving as a comma separated value file and then importing into freeway. It might get the data into FW but I think you will have to spend some time formatting the result.
I have a client that has built a four sheet interactive spread sheet and wants me to “integrate” it into their site. One sheet is over 7000 rows of data, Next two sheets would be displayed. The fourth sheet contains the input data. The viewer is to enter a state (on the spreadsheet you type in the complete US state name, ie Virginia) and then a table is scanned and summed to display information (on sheet 3) for that state. Sheet two is a static summation of the data.
I am evaluating two implementation strategies. MySQL/PHP and editgrid.com.
I have looked at editgrid.com and I can display information, and possibly input the information, but then the entire spreadsheet has to have public RW permissions. The input strategy is also not optimal since the user has to type in the entire state name.
I have little php experience. Today, I setup the database and uploaded the data into a table. Am now sorting through the php actions on actionforge.com.
So, to answer your question, I guess the summing would be in freeway if I use php. Your insight and suggestions are greatly appreciated.
I would skip over most of those Actions. There are a couple which
allow you to integrate PHP code hand-written in a text editor into a
Freeway page – that’s where I would recommend you look most intensely.
Download a free copy of TextWrangler from http://barebones.com and
work through the first couple of chapters of the book.
Then have a look at the MyActiveRecord library for a very quick way to
get your database on line.
and Generate to create a working application from your data in a few
clicks:
Walter
On Mar 9, 2011, at 6:02 PM, jan smoot wrote:
I have little php experience. Today, I setup the database and
uploaded the data into a table. Am now sorting through the php
actions on actionforge.com.
Walter,
Two books, new actions and hand coding. Doesn’t feel very hopeful or fast. I have already setup and uploaded my data into a mysql database via my host c-panel. What’s wrong the the freeway php actions? I have read through your github.com info. Very intimidating. Any templates I could check out?
The Actions encourage (can’t be made to work any other way) a very
sloppy coding practice known as “spaghetti code” in the trade. What
this means is that you have HTML and business logic mixed together in
the same file. While this will work, it leads to difficult-to-read
code, and mistakes, usually in that order.
If you just want to get a table of data to show on the screen, all you
need to do is this:
Make sure that your database table has an auto-incrementing primary
key with the name ‘id’. Make note of the name of your table, I’ll call
it ‘widgets’ here.
Make a new blank page in your Freeway document called listing.php
(or whatever.php).
Using a programmer’s text editor, create a text file named
include.php and put the following code into it: gist:864492 · GitHub
You’ll need to edit that to reflect your actual table and database
names, along with the username and password your hosting provider gave
you to access your database server. If your database hostname isn’t
localhost, change that part of the first line to match, too.
Using the PUIP Action interface, attach the MyActiveRecord.php file
(downloaded from Github here: GitHub - walterdavis/myactiverecord: Fork of MyActiveRecord by Jake Grimley
– just push the big Download button on the right side of the page,
then double-click the file to un-zip it, and locate the file
MyActiveRecord.php in the resulting folder) followed by the
include.php file you wrote and saved on your computer. They have to go
in that order.
From the main menu, choose Insert / Markup Item. You’ll see a
little code box appear. Type in exactly this: <?php echo $out; ?>
(but without the back-ticks you see surrounding that code if you’re
viewing this in mail).
Upload to the server, and browse to your page. If nothing has gone
wrong (possible, even likely I’ve typed something wrong here – I’m
famous for that) you should see a gigantic table on screen with every
row of your database and every column in each row besides the auto-
number ID.
This is as simple and self-contained an example as I can give you.
Once you get that part working, I can share some very simple code to
make the entire thing click-to-edit. Literally 10 or 15 more lines of
code and you can have Excel in a Web browser!
Walter
On Mar 10, 2011, at 11:51 AM, jan smoot wrote:
Walter,
Two books, new actions and hand coding. Doesn’t feel very hopeful or
fast. I have already setup and uploaded my data into a mysql
database via my host c-panel. What’s wrong the the freeway php
actions? I have read through your github.com info. Very
intimidating. Any templates I could check out?
It’s slow going, but I have accomplished a lot today!
I had already uploaded my data, and via your instructions, needed to add the primary key. Finally got that figured out.
Following your screencast, I proceeded to download the generate folder and implemented what I could. I was able to verify the database connection with scaffold.php. I had an improper database name, which scaffold flagged. So, that was helpful.
I have edited the gistfile.php for include in Freeway. Have not tested this out yet.
My application does not call for just displaying the data, in fact, I need to create two other tables from the big data set. One is keyed on the State field. User will select a state from a pulldown, then table is built with summary information selecting only line items matching the state and summing the information in categories. The second table is a summation of a few fields in the data file, again broken into categories. Categories like 1-1000,1000-2000, 2000-5000, etc. ie Stores in Utah with 1-1000 widgets, etc. Any/All suggestions are helpful.
I would be interested in the code you offer to edit the spreadsheet entries.
I am making notes so that if/when I need to do something like this again, it won’t take days! Maybe just hours (and hours)
Thanks for your support. It helps make it possible. More to go! Last 10% always takes 90% of the time!
My application does not call for just displaying the data, in
fact, I need to create two other tables from the big data set. One
is keyed on the State field. User will select a state from a
pulldown, then table is built with summary information selecting
only line items matching the state and summing the information in
categories. The second table is a summation of a few fields in the
data file, again broken into categories. Categories like
1-1000,1000-2000, 2000-5000, etc. ie Stores in Utah with 1-1000
widgets, etc. Any/All suggestions are helpful.
There’s another way to look at this. These extra tables you want to
show are merely filtered results of a query against the database. So
the same exact table code would be used, but the initial query would
change from MyActiveRecord::FindAll('widgets') to MyActiveRecord::FindAll('widgets','brand LIKE "foo"') to only return
the matching records. In your application, you would search on state LIKE "%' . $userStateEntry . '%"' to get a “fuzzy match” against
whatever they entered. The code I posted earlier could be modified to
have a default entry of “find everything” and then a filter builder to
come up with the restrictions to present the filtered list.
I would be interested in the code you offer to edit the
spreadsheet entries.
The way I have done this in the past is to include the tablekit[1]
JavaScript library, and then build a callback function that takes its
request and returns the edited result. In order for this to work, you
need to modify the table builder a little bit, so that each column of
the table has an ID to match its database column name, and each row
has an ID to match the primary key ID from that record. I’ll update
the Gist in a bit to include that. Once those variables are there to
be communicated to the server, it’s quite trivial to update the content:
On Mar 10, 2011, at 5:38 PM, Walter Lee Davis wrote:
The way I have done this in the past is to include the tablekit[1]
JavaScript library, and then build a callback function that takes
its request and returns the edited result. In order for this to
work, you need to modify the table builder a little bit, so that
each column of the table has an ID to match its database column
name, and each row has an ID to match the primary key ID from that
record. I’ll update the Gist in a bit to include that. Once those
variables are there to be communicated to the server, it’s quite
trivial to update the content:
A couple of things I left out of this. First, name that second Gist
file update.php, because that’s what the code I just added to the
first Gist tells tablekit to look for.
Second, after you download tablekit, you’ll also need to download
Prototype.js from http://prototypejs.org and use the External
JavaScript Action to add prototype.js (first) and tablekit.js (second)
to the head of your test page. Follow that up with a brief dip into
the Page /HTML Markup dialog, in the Before section, to add
the little script block I tacked on to the original Gist.
With all of those changes in place, you should be ready to click-to-
edit anywhere in your table.
On Mar 10, 2011, at 5:49 PM, Walter Lee Davis wrote:
On Mar 10, 2011, at 5:38 PM, Walter Lee Davis wrote:
The way I have done this in the past is to include the tablekit[1]
JavaScript library, and then build a callback function that takes
its request and returns the edited result. In order for this to
work, you need to modify the table builder a little bit, so that
each column of the table has an ID to match its database column
name, and each row has an ID to match the primary key ID from that
record. I’ll update the Gist in a bit to include that. Once those
variables are there to be communicated to the server, it’s quite
trivial to update the content:
A couple of things I left out of this. First, name that second Gist
file update.php, because that’s what the code I just added to the
first Gist tells tablekit to look for.
Second, after you download tablekit, you’ll also need to download
Prototype.js from http://prototypejs.org and use the External
JavaScript Action to add prototype.js (first) and tablekit.js
(second) to the head of your test page. Follow that up with a brief
dip into the Page /HTML Markup dialog, in the Before
section, to add the little script block I tacked on to the original
Gist.
I am on your step 5 above. I have both the MyActiveRecord.php and the include.php (configured correctly I think) identified via the PUIP action. I have Create Output Buffer checked and open with Finder (which is the default). I upload, and I see both the .php files being uploaded by freeway, but I don’t see them on the server and my .html (when I do view source) has almost nothing in it. I have the markup item with <?php echo $out; ?> in it. I did a publish everything.
Not sure what I’m doing wrong? So close! To getting to the hard stuff…writing the actual php to create these tables. Am sure it will be elegant once it is done. All for tonight. Thanks.
Try this. First, un-check the output buffer – you won’t need it in
this case. Second, change Finder to BBEdit or TextWrangler or whatever
text editor you have installed. Now, to check to see if the Action is
doing what it should, first set your text editor as a browser, using
File / Preview in Browser / Browsers… (Simply add TextWrangler or
whatever you use there as if it was another browser.)
Now, back in your page, click on the Browser button in the top-right
of the screen, and choose your text editor as the browser. You should
see a little block of php code at the very top of the page – before
the DOCTYPE and opening HTML tag. There should be an include statement
for MyActiveRecord and another for your include page.
Walter
On Mar 11, 2011, at 12:54 AM, jan smoot wrote:
Walter,
I am on your step 5 above. I have both the MyActiveRecord.php and
the include.php (configured correctly I think) identified via the
PUIP action. I have Create Output Buffer checked and open with
Finder (which is the default). I upload, and I see both the .php
files being uploaded by freeway, but I don’t see them on the server
and my .html (when I do view source) has almost nothing in it. I
have the markup item with <?php echo $out; ?> in it. I did a
publish everything.
Not sure what I’m doing wrong? So close! To getting to the hard
stuff…writing the actual php to create these tables. Am sure it
will be elegant once it is done. All for tonight. Thanks.
Got it! Am echoing the data. Unable to work on this for a while–another project calls me away, but hope to return to this later today. Thank you Walter for getting me this far!
I see the echo does not print the index id. Would be helpful to verify it is printing all the records–I have close to 8,000.
Next to try your php code out and see if I can create my tables and format them via my designers layout…
What that will do is put all of the columns in the database on the
screen, because it will include ‘id’ in the $visible_columns array
instead of hiding it.
Walter
On Mar 11, 2011, at 10:02 AM, jan smoot wrote:
I see the echo does not print the index id. Would be helpful to
verify it is printing all the records–I have close to 8,000.