A feature I'd love to see would be the ability to use javascript to serve up the current "hits" in the html output of the links directory. Essentially, at least for me, that is the only reason to have the dynamic version. Movable Type also has html pages but outputs the number of "comments" and "trackbacks" dynamically.
In the html version, but the data is available in the database...and the dynamic version displays the correct number...so with javascript, would it be possible to point to a script, run a query and pull out the number of "hits" for that link from the database and dynamically display only that part of it?
Feb 26, 2003, 12:49 AM
Administrator (9387 posts)
Feb 26, 2003, 12:49 AM
Post #6 of 7
Views: 2170
Well, if you got a powerful server you could:
1. Add a global called:
fetch_hits => sub { return $DB->table('Links')->select('Hits', { ID => shift })->fetchrow }
2. Create a template called hits.html with:
<%fetch_hits($ID)%>
3. Use ssi on your static html pages (link.html template):
<!--#include virtual="/cgi-bin/page.cgi?p=hits&ID=<%ID%>"-->
However, you need to realize that when you display your static html page, it's going to make one call to page.cgi for every link on the page. Might slow things down dramatically.
Cheers,
Alex
--
Gossamer Threads Inc.
1. Add a global called:
fetch_hits => sub { return $DB->table('Links')->select('Hits', { ID => shift })->fetchrow }
2. Create a template called hits.html with:
<%fetch_hits($ID)%>
3. Use ssi on your static html pages (link.html template):
<!--#include virtual="/cgi-bin/page.cgi?p=hits&ID=<%ID%>"-->
However, you need to realize that when you display your static html page, it's going to make one call to page.cgi for every link on the page. Might slow things down dramatically.
Cheers,
Alex
--
Gossamer Threads Inc.