Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Mixing dynamic content into html pages

Quote Reply
Mixing dynamic content into html pages
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.
Quote Reply
Re: [dwh] Mixing dynamic content into html pages In reply to
Can you use a global tag?...or do you want it to be dynamic?

If the latter how about using page.cgi?

Btw what "hits" are you referring to?
Quote Reply
Re: [Paul] Mixing dynamic content into html pages In reply to
I want it to be dynamic within the html...by hits I refer to this from the demo:

Quote:
Added: Wed Mar 08 2000 Hits: 8150 Rating: 5.76 Votes: 204

Quote Reply
Re: [dwh] Mixing dynamic content into html pages In reply to
I think hits stats are only updated during a build?

Last edited by:

Paul: Feb 25, 2003, 8:20 AM
Quote Reply
Re: [dwh] Mixing dynamic content into html pages In reply to
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?
Quote Reply
Re: [dwh] Mixing dynamic content into html pages In reply to
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.
Quote Reply
Re: [dwh] Mixing dynamic content into html pages In reply to
What Alex is saying (implying), is why not just run the site dynamically?


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.