PDA

View Full Version : External data using javascript


delds
09-09-2005, 05:53 PM
Looking to be able to post links to the latest threads or latest threads that were posted to,
---------------
<script src="http://www.selfhelpforums.com/external.php?type=js" type="text/javascript"></script>
<script type="text/javascript">
<!--
for (i in threads)
{
document.writeln(threads[i].title + " (" + threads[i].poster + ")<br />");
}
//-->
</script>
-------------------

This gives me I believe the last 15 threads, not sure if it is the last 15 threads created or last 15 threads that were posted to.

But they are not clickable (no actual link), is it possible to change the number displayed and can they be made a clickable link. trying to use it in .htm page.

running vb 3.5 rc 2, which will within the next day be rc 3

azmi
09-15-2005, 07:22 AM
just try this (code from our german vb forum)
have a look to see how it works (left site)
http://koelnboard.de


<!--
var max = 13;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length > 50)
{ threads[i].title = threads[i].title.substring(0, 20) + '...'; }
document.writeln("<li><a href=\"http://www.yourforum.com/forum/showthread.php?t=" + threads[i].threadid + "\" style=\" color:black; \">" + threads[i].title + "</a><br> (" + threads[i].poster + " - Erstellt am: " + threads[i].threaddate + ") <br><br></li>");
}
//-->

delds
09-15-2005, 03:34 PM
Thank you, just what I was looking for

just have find out what 'Erstellt am' is in english

azmi
09-15-2005, 06:53 PM
just have find out what 'Erstellt am' is in english sorry, i forgot to translate it
i hope it works ;)

solokron
10-08-2005, 07:45 AM
Hmmm I have enabled External Javascript in the acp and incorporated this js into my page with the domain changes of course and have had no success. It simply does not list for me.

just try this (code from our german vb forum)
have a look to see how it works (left site)
http://koelnboard.de


<!--
var max = 13;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length > 50)
{ threads[i].title = threads[i].title.substring(0, 20) + '...'; }
document.writeln("<li><a href=\"http://www.yourforum.com/forum/showthread.php?t=" + threads[i].threadid + "\" style=\" color:black; \">" + threads[i].title + "</a><br> (" + threads[i].poster + " - Erstellt am: " + threads[i].threaddate + ") <br><br></li>");
}
//-->