vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Compose External Javascript (https://vborg.vbsupport.ru/showthread.php?t=59776)

Bernd Glasstett 01-05-2004 10:00 PM

Compose External Javascript
 
vB Compose External v. 1.0.3 (Updated)

This hack provides an easy way to generate JS-Code for the Javascript syndication system on vB 3. It has been tested with VB 3.0.0 RC 1 and higher.

Features:

  • Complete control of the HTML-code before, after and in between the links to the threads
  • Possibility to enter a maximum-value for the count of threads to be displayed by the administrator
  • Users can choose more than one forum to be displayed
  • Users can choose how many threads to be displayed
  • Users can choose how many characters in the thread title should appear (new in version 1.0.1)
  • Users can choose from three pre-made styles (new in version 1.0.3)
  • Integration into forumdisplay and navbar-templates (new in version 1.0.4)
  • Complete integration in the look and feel of vB 3
  • Phrase-compatibility
Plans for future versions:
  • Option to choose the forums from a pulldown-men?
  • Option to add it to the forum-tools (in order to be able to have the JS-Script created for this specific forum)
  • Options for creating the URLs for XML- and RSS-feeds
  • Adding new features when external.php will be updated with new features ;)
These are the instructions how to install it:
  • New templates: 1
  • Templates to be changed: 2
  • PHP-files to be added: 1
  • Phrases to be added: 23
Step 1:
Insert the phrases using the XML-files. There are phrases for some languages. You can of course translate them to other languages using the phrase-system. If you do so, please send me the XML-files for these translations. I will add them to this ZIP. Right now there are:
  • German
  • English
Please be sure to save the language in the phrase system BEFORE you do so!

Step 2:
Upload the file composeexternal.php in the root of your forum.
Upload the files in the folder /images/composeexternal/ on the server.


Step 3:
Add a new template with the name "composeexternal" and add the content of composeexternal_template.txt (in this zip) to it.

Step 4:
Search for the following code on template forumdisplay:
Code:


                    <div><img class="inlineimg" src="$stylevar[imgdir_button]/subscribe.gif" alt="$vbphrase[view_parent_forum]" vspace="1" /> <a href="forumdisplay.php?$session[sessionurl]f=$foruminfo[parentid]">$vbphrase[view_parent_forum]</a></div>
                </div>
        </td>
        <!-- / forum tools -->

Replace with the following code:
Code:


                    <div><img class="inlineimg" src="$stylevar[imgdir_button]/subscribe.gif" alt="$vbphrase[view_parent_forum]" vspace="1" /> <a href="forumdisplay.php?$session[sessionurl]f=$foruminfo[parentid]">$vbphrase[view_parent_forum]</a></div>
                </div>
                    <div><img class="inlineimg" src="$stylevar[imgdir_button]/subscribe.gif" alt="$vbphrase[composeexternal_categorystrip]" vspace="1" /> <a href="composeexternal.php?$session[sessionurl]do=composecode&amp;f=$foruminfo[forumid]">$vbphrase[composeexternal_categorystrip]</a></div>
 
        </td>
        <!-- / forum tools -->



Search for:
Code:


        <if condition="$show['adminoptions']">

Add above:
Code:


        <tr><td class="vbmenu_option"><a href="composeexternal.php?$session[sessionurl]do=composecode&amp;f=$foruminfo[forumid]">$vbphrase[composeexternal_categorystrip]</a></td></tr>



Step 5:

Search for the following code on template navbar:

Code:

                  <if condition="$show['wollink']"><tr><td class="vbmenu_option"><a href="online.php?$session[sessionurl]">$vbphrase[whos_online]</a></td></tr></if>



Add below:
Code:

                <tr><td class="vbmenu_option"><a href="composeexternal.php?$session[sessionurl]">$vbphrase[composeexternal_categorystrip]</a></td></tr>




Credits go to Ypsfanpage.de - a user of our forum. He coded the initial php-file. I ported it to the VB-system and created the php-file and the template.

See the screen-shots below, how it works, or visit our testsite.

Version-History
v. 1.0.0 - Initial release
v. 1.0.1 - Added character-limitation
v. 1.0.2 - Got rid of a small bug, occuring in MSIE, happened when there where too less threads, genereal optimization of the code
v. 1.0.3 - Added three pre-made templates
v. 1.0.4 - Added support for forumdisplay-template and navbar-template

Please click on install, when you choose to use this hack :)

FleaBag 01-06-2004 01:13 PM

This is a great idea, might use it on my site when I get to vB3.

gldtn 01-06-2004 02:30 PM

Very nice.. Do you think you can add some type of option to limit the amount of characters to show.. something like:

<script type="text/javascript"src="http://www.cogumelosmagicos.org/forum/external.php?forumids=30,31,32,38,40&type=js">
</script>
<script type="text/javascript">
<!--
for (i = 0; i < 1; i++)
var titleAsString = new String(threads[i].title);
if (titleAsString.length > 27)
{
var newTitle = titleAsString.substring(0,27);
document.write("Tópico: <a href=\"http://www.cogumelosmagicos.org/forum/showthread.php?threadid="+threads[i].threadid+"\">"+newTitle + "..."+"</a><br />Autor: <a href=\"http://www.cogumelosmagicos.org/forum/member.php?u="+threads[i].poster+"\">"+threads[i].poster+"</a> - "+threads[i].threadtime+"<br />");
}
else
{
document.write("Tópico: <a href=\"http://www.cogumelosmagicos.org/forum/showthread.php?threadid="+threads[i].threadid+"\">"+titleAsString+"</a><br />Autor: <a href=\"http://www.cogumelosmagicos.org/forum/member.php?u="+threads[i].poster+"\">"+threads[i].poster+"</a> - "+threads[i].threadtime+"<br />");
}
//-->
</script>

Thank You

Bernd Glasstett 01-06-2004 04:27 PM

I am incorparating that at this moment, will soon post the new file :) Plus, I already have some new ideas. Will post them also soon :)

Bernd Glasstett 01-06-2004 06:22 PM

Ok, here we go, just updated the file. The old version - if someone doesn't need the character-limitation - is still available for download.

Two more phrases have been updated with the new release:
- composeexternal_charlimit
- composeexternal_charlimitdescription

gldtn 01-06-2004 07:23 PM

Got it.. It works fine.. Thanks a lot.. I hope you'll add more feature to it on future releases... features such as pulling polls, etc..

Also a link to the poster would be nice..

[high]* gldtn clicks install :)[/high]

Bernd Glasstett 01-06-2004 07:52 PM

Quote:

Originally Posted by gldtn
Got it.. It works fine.. Thanks a lot.. I hope you'll add more feature to it on future releases... features such as pulling polls, etc..

Also a link to the poster would be nice..

[high]* gldtn clicks install :)[/high]

We (Ypsfanpage.de and me) were already thinking about hacking the external.php too. That's because the options are limited there. At the moment we will extend the hack to have also XML and RSS supported. It might look then like the user-panel when we are done :)

And if by then it is foreseeable, that Jelsoft is not going to extend the external.php, we will look into that. I would love to see some more things to appear there too. Polls, postings, poster. They are all not covered right now.

gldtn 01-06-2004 08:19 PM

Awesome, I'm looking forward to this, If my scripting knowledge was any good I would've be willing to help you guys out.

Thanks once again for this great hack :D

eva2000 01-06-2004 08:53 PM

nice script you got there :)

seems what ever is generated when used on a web site generates a javascript error in IE 6.0.2800.1106

Code:

Error: 'threads[...].title' null or not an object
Code: 0


eva2000 01-06-2004 09:23 PM

okay so that error is due to having less than 15 threads in the forum being called :o

i got it working with this code thanks to your generator

saved the below code in a file named last15.php

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Example code</TITLE>
</HEAD>
<BODY>
<script type="text/javascript" src="http://forumdomain.com/external.php?forumids=<?php echo($fid); ?>&type=js"></script>

<b>Last 15 threads :</b>
<ul>
<script type="text/javascript">
<!--
for (i = 0; i < 15; i++)
{
 if (threads[i].title.length > 60)
 { threads[i].title = threads[i].title.substring(0,60) + '...'; }
 document.writeln("<li><a href=\"http://forumdomain.com/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a> (" + threads[i].poster + " : " + threads[i].threaddate + " : " + threads[i].threadtime + ") </li>");
}
//-->
</script>
</ul>


</BODY>
</HTML>

then used last15.php?fid=XX

where fid is the forumid i want to call


All times are GMT. The time now is 04:52 AM.

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.01615 seconds
  • Memory Usage 1,763KB
  • 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
  • (8)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete