vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   javascript help - latest posts (https://vborg.vbsupport.ru/showthread.php?t=224481)

BlackJacket 10-03-2009 03:41 PM

javascript help - latest posts
 
Is this correct?

Code:

ctr = 0;
for (x in threads)
{
  document.writeln("<a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a><br />");
ctr++;
if (ctr == 8)
  {
    break;
  }
}


I keep getting an error and my latest threads wont display right.
Thanks for the help.

Lynne 10-03-2009 06:39 PM

It always helps if you post the actual error you are getting.

See this thread - http://www.vbulletin.com/forum/showthread.php?t=283817

BlackJacket 10-03-2009 07:03 PM

Quote:

Originally Posted by Lynne (Post 1894310)
It always helps if you post the actual error you are getting.

See this thread - http://www.vbulletin.com/forum/showthread.php?t=283817

Thank you again Lynne.


***To fix this issue***

Enable external javascript

AdminCP>VB Options>External Data Provider>

I also had to fix the JS as it was not correct -

Code:

<!--
for (var x in threads)
{
document.writeln("<a href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a> (Posted By: "+threads[x].poster+")<br />");
}
//-->


kevcj 10-04-2009 03:19 AM

Here, try this, its the code I use on my site. This will display the most recent 15 threads.


Quote:

<script type="text/javascript" src="http://www.YOURSITENAME.com/forum/external.php?&type=js"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 15; x++)
{
document.writeln("*<a href=http://www.YOURSITENAME.com/forum/showthread.php?t="+threads[x].threadid+">"+threads[x].title+"</a><br />");
}
//-->
</script>
That came straight off the sidebar of my wordpress blog, so it should work.

Lift for Life 10-12-2009 12:17 AM

Thanks for the code above,,, I've spent the better part of the day trying to get recent posts to show up on an html page and this one did the trick.

Thanks!

Lift


All times are GMT. The time now is 10:30 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01854 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete