.
do not copy code using translator

*
xtgem
Twitter blog Facebook
TUTORIAL
MobileStimulus
Mobilestimulus
To fully use these widgets
You must register at

There are a large number of updates and add ons for these widgets
please visit
XtCat club on XtBoard
X T B O A R D
For the latest information
DOWNLOAD HIT IMAGE COUNTERS
This uses a xt:filelist function XtCat image counters and a dynamic target page with xt:widgets xt:get variables a little css and a meta refresh code
to create download hit counters.
It does NOT use ANY javascript.
The code is rather complex due to parts being coded as a xt:filelist template where the reserved characters
< > & "
must be converted to their html entity equivalents
&lt; &gt; &amp; &quot;
Also the image code requires that & characters are triple encoded as
&amp;amp;amp;
to prevent validator warning hits.
The Code
Start with a normal xt:filelist function
<xt:filelist sort_type="name" sort_dir="asc" folder="/YOUR_FOLDER" filter="-index*" template="" />
The Template
Then start constructing the template code
This is the code BEFORE it is encoded
it is NOT the final code
The Inner Holder
First comes the code for the <div> that holds each entry
<div style="border-bottom:1px solid">
The Counter Image
Next is the code to produce the actual counter image.
It is really a call to a PHP function on the XtCat site that creates the image on the fly.
By default the image has a transparent background and black text
wd = width of image
<img src="http://xtcat.xtgem.com/content/images/tools/counter/index.png?wd=50&site=<xt id=url type="domain" />&xtuser=YOUR_XTCAT_USERNAME&idstring=.file_name. &key=YOUR_XTCAT_KEY" alt="•" />
Other image parameters
six digit hex code for the background color
bg=hhhhhh
six digit hex code for the text color
tc=hhhhhh
The link
This is the link to the download target page. It sets the name of the file as a variable.
<a href="DOWNLOAD_TARGET_PAGE?file=.file_name."> .file_name_parsed.</a>
Then close the inner holder
</div>
The Final Code
Here is the final code with the correct encoding.
Set your own values where the code is in UPPERCASE
The Download Target Page
The XtCat widget creates and increments the counter using the name of the file in the Xt:get variable
type="none" means the counter is hidden
<xt:widget tool="Counter" type="none" idstring="{_$file|dummy}" key="YOUR_XTCAT_KEY" xtuser="YOUR_XTCAT_USERNAME" id="xt.c.a.t." />
The actual download is accomplished using a meta refresh code
<meta http-equiv="refresh" content="0;url=http://YOUR_SITE.DOMAIN/YOUR_FOLDER/{_$file|..}" />
Then a little css style in the <body> tag to hide the page
<body style="display:none">
The Complete Code
This Is the complete code for the target page.
Copy it to a blank PLAIN TEXT file with your chosen name
Set your own values where shown NOTE:If you wish to have different download pages pointing to the same list of files with a separate set of counters or just want to identify a particular list
add a identifier to the idstring parameter in BOTH the image code and the counter widget on the target page for that list ie:
idstring=.file_name.1
and on the target page
idstring="{_$file|dummy}1"
"•" Eagles21.mp3
"•" MOTD.mp3
"•" Wild-foods.pdf
"•" countdown.zip
"•" djbones.mp3
"•" gauge.jpg
"•" harper control.mp3
"•" horse.ogg
"•" impossible.mid
"•" planet-b.gif
"•" queen dust.mp3
"•" sister rosetta.mp3
"•" star trekin.mp3
"•" test html.html
"•" vbw.swf
"•" wotw ep1.mp3
"•" wotw ep2.mp3
"•" ybcu1a.wav
BACK

Main Page
©2010 - 2024 Graham.yn.lt
X T B O A R D
X T G E M
© MMXXIV Graham