View Single Post
  #24  
Old 09-13-2006, 12:06 AM
MRGTB MRGTB is offline
 
Join Date: Dec 2004
Posts: 548
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just cant get my head around adding "cache" to a product, to cache the templates.

Will you do me a favour Princeton or anybody else who knows how to do this. Take a look at my product code and add the cache code for me. So I can just paste it back in my XML file.

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="ed2k_links_hack" active="1">
	<title>eD2K Links Hack</title>
	<description>This will let you add eD2K Links to your forum board.</description>
	<version>1.0.0</version>
	<url>http://www.ed2k.biz</url>
	<dependencies><dependency dependencytype="vbulletin" minversion="3.6.0" maxversion="" />
	</dependencies>
	<codes></codes>
	<templates>
		<template name="ed2k" templatetype="template" date="1133098897" username="eD2K" version="3.6.0"><![CDATA[<script type="text/javascript">
<!--
function checkAll(str,checked) {
	var a = document.getElementsByName(str);
	var n = a.length;
	for (var i = 0; i < n; i++) {
		a[i].checked = checked;
	}
	em_size(str);
}
function download(str, i, first) {
	var a = document.getElementsByName(str);
	var n = a.length;
	for (var i = i; i < n; i++) {
		if(a[i].checked) {
			window.location=a[i].value;
			if (first)
				timeout = 6000;
			else
				timeout = 500;
			i++;
			window.setTimeout("download('"+str+"', "+i+", 0)", timeout);
			break;
		}
	}
}
function copy(str) {
	var a = document.getElementsByName(str);
	var n = a.length;
	var ed2kcopy = document.getElementById("ed2kcopy_"+str)
	ed2kcopy.innerHTML = ""
	for (var i = 0; i < n; i++) {
		if(a[i].checked)
		{
			ed2kcopy.innerHTML += a[i].value;
			ed2kcopy.innerHTML += "<br />";
		}
	}
		var rng = document.body.createTextRange();
		rng.moveToElementText(ed2kcopy)
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
}
function em_size(str) {
	var a = document.getElementsByName(str);
	var n = a.length;
	try {
		var input_checkall = document.getElementById("checkall_"+str);
		var size = 0;
		input_checkall.checked = true ;
		for (var i=0; i < n; i++) {
			if (a[i].checked) {
				var piecesArray = a[i].value.split( "|" );
				size += piecesArray[3]*1;
			} else {
				input_checkall.checked = false;
			}
		}
		test = document.getElementById("size_"+str);
		test.innerHTML = gen_size(size, 3, 2);
	} catch (e) {
	}
}
function gen_size(val, li, sepa ) {
	sep = Math.pow(10, sepa);
	li = Math.pow(10, li);
	retval  = val;
	unit	= 'Bytes';
	if (val >= li*1000000000) {
		val = Math.round( val / (1099511627776/sep) ) / sep;
		unit  = 'TB';
	} else if (val >= li*1000000) {
		val = Math.round( val / (1073741824/sep) ) / sep;
		unit  = 'GB';
	} else if (val >= li*1000) {
		val = Math.round( val / (1048576/sep) ) / sep;
		unit  = 'MB';
	} else if (val >= li) {
		val = Math.round( val / (1024/sep) ) / sep;
		unit  = 'KB';
	}
	return val + unit;
}
// -->
</script>
<br /><table class="tborder" cellpadding="5" cellspacing="1" border="0" width="100%" align="center">
  <thead><tr><td class="tcat" colspan="2">eD2K Links</td></tr></thead><tbody>

$ed2kbit

<tr align="left" class="alt$key2"><td width="80%" align="left"><input type="checkbox" id="checkall_ed2k$rand" onclick="checkAll('ed2k$rand',this.checked)" checked="checked"/><label for="checkall_ed2k$rand">Select All</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Download Selected" onclick="download('ed2k$rand',0,1)" /> <input type="button" value="Copy Selected" onclick="copy('ed2k$rand')" /><div id="ed2kcopy_ed2k$rand" style="position:absolute;height:0px;width:0px;overflow:hidden;"></div></td><td align="center" id="size_ed2k$rand">Total Size: $total</td></tr></tbody></table>]]></template>
		<template name="ed2kbit" templatetype="template" date="1133028805" username="eD2K" version="3.6.0"><![CDATA[<tr align="left" class="alt$key1"><td width="80%" align="left"><input type="checkbox" name="ed2k$rand" value="$ed2k" onclick="em_size('ed2k$rand');" checked="checked" /><a href="$ed2k">$ed2k_array[2]</a></td><td align="center">$totalper</td></tr>]]></template>
	</templates>
	<plugins>
		<plugin active="1">
			<title>eD2K Links Hack</title>
			<hookname>bbcode_fetch_tags</hookname>
			<phpcode><![CDATA[if ($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_URL)
		{
// [ED2K]
   $tag_list['no_option']['ed2k'] = array(
    'callback' => 'handle_ed2k_links',

   );
}]]></phpcode>
		</plugin>
	</plugins>
	<phrases>
	</phrases>
	<options>
	</options>
</product>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01240 seconds
  • Memory Usage 1,799KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete