Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2011, 08:59 PM
GameExploiters GameExploiters is offline
 
Join Date: Feb 2010
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default External.php and some code?

Greetings VBulletin.org,

I have this code, which a friend of mine made for me, and it works just fine. Except it shows a very long list of threads and doesn't end. How do i put a limit of 5 threads ?

PHP Code:
<div class="block recent-threads">
                    <
h3 class="block-title"><span>Recent Forum Threads</span></h3>
                    <
ul class="list-threads">
<
script type="text/javascript" src="http://www.My-Site.net/forum/external.php?type=js"></script>

<
script type="text/javascript" src="http://localhost/forum/external.php?type=js"></script>

<
script type="text/javascript">
<!--
        var 
maxlen 15;
    for (var 
0threads.lengthi++)
    {
            var 
title = (threads[i]['title'].length maxlen threads[i]['title'].substr(0maxlen) + "..." threads[i]['title']);
            
document.write ('<a href="http://www.My-Site.net/forum/showthread.php?t=' threads[i]['threadid'] + '"> <img src="/images/arrow.gif"> <span style="color:#FFFF00"> ' title ' </span> </a> <em>Posted by: ' threads[i]['poster'] + '</em><br />');
    }
//-->
</script>
                    </
ul>
                    <
div class="showallnews"><a href="/forum/search.php?do=getdaily" title="View all news">Show me all news</a></div>
                </
div

I'd also like to know how i make it display any new thread made in my announcements forum and updates forum, on my front page.

It should be displayed in a few parts. Title, poster, thread link and the things within the thread. Also, will the vBulletin BBC code act up when it's read via external.php ?

Thanks in advance,
GE
Reply With Quote
  #2  
Old 08-22-2011, 09:04 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To limit the number of threads, you could do this:

PHP Code:
...
<
script type="text/javascript"
<!-- 
        var 
maxlen 15
        var 
maxthreads = (threads.length threads.length 5);
    for (var 
0maxthreadsi++) 
    {
... 

I don't know about the second question - I think you should get threads from any forums that would be included in an external feed.

Edit: The forums need to be readable by guests or they won't be included, maybe that's the issue?
Reply With Quote
  #3  
Old 08-22-2011, 10:00 PM
GameExploiters GameExploiters is offline
 
Join Date: Feb 2010
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
To limit the number of threads, you could do this:

PHP Code:
...
<
script type="text/javascript"
<!-- 
        var 
maxlen 15
        var 
maxthreads = (threads.length threads.length 5);
    for (var 
0maxthreadsi++) 
    {
... 

I don't know about the second question - I think you should get threads from any forums that would be included in an external feed.

Edit: The forums need to be readable by guests or they won't be included, maybe that's the issue?
Thanks for the help. I'll see if that works sometime tomorrow (:

Also, I do know it needs to be readable by guests. But I'd like to know HOW to it display the different parts of each thread, on the site with the different things which are stated above.

Note: It's a actual site, i coded in HTML. I just want the front page to display the 5 latest threads in my announcement forum on the frontpage. I divided different parts of the format for announcements into different divs, such as Date, author, body, and reply to thread.

How would i got about grabbing all that date from a thread and making it display properly. I can provide the code for it if you wish.

--------------- Added [DATE]1314100281[/DATE] at [TIME]1314100281[/TIME] ---------------

Bump, could anyone help me with this ?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07813 seconds
  • Memory Usage 2,205KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete