vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Preview and copy buttons for Edit Template (https://vborg.vbsupport.ru/showthread.php?t=21518)

ToraTora! 08-27-2001 05:34 AM

well, i pulled it out. The documentation doesnt warrent my attention any longer. There is no way of knowing where this thing starts, or where it ends.

LuBi 08-27-2001 05:41 AM

It's a great code man, try again. Follow it eactly, I'm a newbot I got it. I installed like 5 hacks today on my new forum. Some for me to make my life easier and some for the users. Re-up your orig files and start from scratch. It's really worth it.

FWC 08-27-2001 05:44 AM

Quote:

Any hints?
You need the first three lines:

PHP Code:

$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() { 

It works fine with them.

ToraTora! 08-27-2001 05:44 AM

ok, i will, but give me a breakdown of what you did, because i may be adding code, that has nothing to do with actually being there, since the documentation runs altogether like it does..
something like this..

Find blah.
PHP Code:

report error 7 

add
PHP Code:

blah 

find
PHP Code:

blah blah 

add
PHP Code:

blah blah blah 

If you could do that for me Lubi, it would be most appreciated. :)

ToraTora! 08-27-2001 05:46 AM

Quote:

Originally posted by FWC


You need the first three lines:

PHP Code:

$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() { 

It works fine with them.


See, i dont even see that line anywhere in the documentation...im going fuc*ing blind i think...

ToraTora! 08-27-2001 05:47 AM

this is all done, within the admin/template.php file correct?

I mean, there isnt some other file, or some other template possibly that im missing here...

ToraTora! 08-27-2001 05:51 AM

still getting the same error.....beats the hell out of me..

FWC 08-27-2001 05:52 AM

This was in the documentation I got:

Quote:

Adds some helpful features to the admin edit template page
- Highlight All and Copy
- Quick & Dirty Preview Template
- Find in template

Made By Mutt
VB2.0.3
updated 08-03-01



edit templete.php

right at the begining of the script just after
<?php
error_reporting(7);

add
$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
There is the first line you added and the three above it. There should haved been a space between the "add" and the first line of code.

FWC 08-27-2001 05:57 AM

Quote:

this is all done, within the admin/template.php file correct?
Yes. The code you displayed before wasn't formatted correctly. Mine starts like this:

PHP Code:

$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");



ToraTora! 08-27-2001 06:02 AM

ok, here is what i got so far...


add after report error 7
PHP Code:


$ButtonExtra
=
<SCRIPT LANGUAGE=\"JavaScript\"> 
function displayHTML() { 
var inf = document.name.template.value; 


Find

PHP Code:

// ###################### Start add #######################
makehiddencode("group""$group"); 

and add above that line:

PHP Code:

makelabelcode("","$ButtonExtra"); 


Find

PHP Code:

// ###################### Start edit #######################
makehiddencode("group""$group"); 

and add above that line:

PHP Code:

makelabelcode("","$ButtonExtra"); 


than of course, you have all of this...and that is the problem, as well as no closing tag for the java script...

PHP Code:


{ var inf document.name.template.valuewin window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes'); win.document.write(\"\" + inf + \"\"); } function HighlightAll() { var tempval=eval(\"document.name.template\") tempval.focus() tempval.select() if (document.all){ therange=tempval.createTextRange() therange.execCommand(\"Copy\") window.status=\"Contents highlighted and copied to clipboard!\" setTimeout(\"window.status=''\",1800) } } var NS4 = (document.layers); // Which browser? var IE4 = (document.all); var win = window; // window to search. var n = 0; function findInPage(str) { var txt, i, found; if (str == '') return false; if (NS4) { if (!win.find(str)) while(win.find(str, false, true)) n++; else n++; if (n == 0) alert('Not found.'); } if (IE4) { txt = win.document.body.createTextRange(); for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { txt.moveStart('character', 1); txt.moveEnd('textedit'); } if (found) { txt.moveStart('character', -1); txt.findText(str); txt.select(); txt.scrollIntoView(); n++; } else { if (n > 0) { n = 0; findInPage(str); } else alert('Not found.'); } } return false; } "


Where does all of that, go....lol

ToraTora! 08-27-2001 06:06 AM

Quote:

Originally posted by FWC


Yes. The code you displayed before wasn't formatted correctly. Mine starts like this:

PHP Code:

$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");




well, that explains a little bit...my question now, would be...is that all that is needed under the error7 area?

It should be that code above, (your code) the code in the start search, and start edit..and thats it?

I mean...i feel like i have completely different documentations here than what you guys have..lol.

ToraTora! 08-27-2001 06:07 AM

also, doesnt there have to be a closing </SCRIPT>
in there as well?

FWC 08-27-2001 06:12 AM

Here's exactly what I have added:

PHP Code:

$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");
}
function HighlightAll() {
    var tempval=eval(\"document.name.template\")
    tempval.focus()
    tempval.select()
    if (document.all){
    therange=tempval.createTextRange()
    therange.execCommand(\"Copy\")
    window.status=\"Contents highlighted and copied to clipboard!\"
    setTimeout(\"window.status=''\",1800)
    }
}
var NS4 = (document.layers);    // Which browser?
var IE4 = (document.all);
var win = window;    // window to search.
var n   = 0;

function findInPage(str) {
  var txt, i, found;
  if (str == '')
    return false;
  if (NS4) {
    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;
    if (n == 0)
      alert('Not found.');
  }

  if (IE4) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart('character', 1);
      txt.moveEnd('textedit');
    }
    if (found) {
      txt.moveStart('character', -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    } else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }
      else
        alert('Not found.');
    }
  }
  return false;
}
</script>
<input name='string' type='text' size=20 onChange='n=0;'>
<input type='button' value='Find' onClick='javascript:findInPage(document.name.string.value)'>&nbsp;&nbsp;&nbsp;
<input type='button' value='Preview' onclick='javascript:displayHTML()'>
<input type='button' value='Copy' onclick='javascript:HighlightAll()'>"


Then the normal admin/template.php begins again.

ToraTora! 08-27-2001 06:18 AM

Quote:

Originally posted by FWC
Here's exactly what I have added:

PHP Code:

$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");
}
function HighlightAll() {
    var tempval=eval(\"document.name.template\")
    tempval.focus()
    tempval.select()
    if (document.all){
    therange=tempval.createTextRange()
    therange.execCommand(\"Copy\")
    window.status=\"Contents highlighted and copied to clipboard!\"
    setTimeout(\"window.status=''\",1800)
    }
}
var NS4 = (document.layers);    // Which browser?
var IE4 = (document.all);
var win = window;    // window to search.
var n   = 0;

function findInPage(str) {
  var txt, i, found;
  if (str == '')
    return false;
  if (NS4) {
    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;
    if (n == 0)
      alert('Not found.');
  }

  if (IE4) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart('character', 1);
      txt.moveEnd('textedit');
    }
    if (found) {
      txt.moveStart('character', -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    } else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }
      else
        alert('Not found.');
    }
  }
  return false;
}
</script>
<input name='string' type='text' size=20 onChange='n=0;'>
<input type='button' value='Find' onClick='javascript:findInPage(document.name.string.value)'>&nbsp;&nbsp;&nbsp;
<input type='button' value='Preview' onclick='javascript:displayHTML()'>
<input type='button' value='Copy' onclick='javascript:HighlightAll()'>"


Then the normal admin/template.php begins again.



Ok, there is the first opening lines of the script...than a person does the other two little mods, and that should be it...
Thanks for your help..it is greatly appreciated. If anything, we helped document this mess for him. :)

i will go try it out, and if this doesnt work, i am not going to bother with it. lol...had enough of it, as i am sure you have had enough of me asking for help. :)

again, thanks FWC, and LuBi for your time and concern to my moronic ignorance that has plagued me with this hack.

Catch ya in a bit.

FWC 08-27-2001 06:21 AM

Quote:

again, thanks FWC, and LuBi for your time and concern
No problem. I'm no programmer. I'm sure you'll help me much more in the future. :D

ToraTora! 08-27-2001 06:23 AM

did you get any java errors with this? I got three rite as i opened up the template area....UGGGG!!!

So, we have the lines you have above, rite under error, and than the other two...now what?>

ToraTora! 08-27-2001 06:27 AM

it is conflicting with the start generate files of line 93,94,95,
which is the db query for the templates....

FWC 08-27-2001 06:32 AM

We're out of my league now. I compared my modified file with my original file. That code was all I added. The first couple lines of the original template.php after the hack are:

PHP Code:

($action=="customize"$action="add";

if (isset(
$action) and $action=="generate") {
  
$noheader=1;
}

require(
"./global.php");

adminlog(iif($templateid!=0,"template id = $templateid",iif($templatesetid!=0,"templateset id = $templatesetid",""))); 


ToraTora! 08-27-2001 06:33 AM

here we go again....

Under report error 7 ADD
PHP Code:


$ButtonExtra
="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");
}
function HighlightAll() {
    var tempval=eval(\"document.name.template\")
    tempval.focus()
    tempval.select()
    if (document.all){
    therange=tempval.createTextRange()
    therange.execCommand(\"Copy\")
    window.status=\"Contents highlighted and copied to clipboard!\"
    setTimeout(\"window.status=''\",1800)
    }
}
var NS4 = (document.layers);    // Which browser?
var IE4 = (document.all);
var win = window;    // window to search.
var n   = 0;

function findInPage(str) {
  var txt, i, found;
  if (str == '')
    return false;
  if (NS4) {
    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;
    if (n == 0)
      alert('Not found.');
  }

  if (IE4) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart('character', 1);
      txt.moveEnd('textedit');
    }
    if (found) {
      txt.moveStart('character', -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    } else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }
      else
        alert('Not found.');
    }
  }
  return false;
}
</script>
<input name='string' type='text' size=20 onChange='n=0;'>
<input type='button' value='Find' onClick='java script:findInPage(document.name.string.value)'>&nbsp;&nbsp;&nbsp;
<input type='button' value='Preview' onclick='java script:displayHTML()'>
<input type='button' value='Copy' onclick='java script:HighlightAll()'>"



Find //////// start search///////////
and the line within that that reads:
PHP Code:

[color=green]makehiddencode("group""$group");[/color

and replace it with:
PHP Code:

makelabelcode("","$ButtonExtra"); 

Find ////////start edit//////////
and the line within that reads:

PHP Code:

[color=green]makehiddencode("group""$group");[/color

and replace it with:
PHP Code:

makelabelcode("","$ButtonExtra"); 



Now..that should be all there is to it correct?

ToraTora! 08-27-2001 06:37 AM

Quote:

Originally posted by FWC
We're out of my league now. I compared my modified file with my original file. That code was all I added. The first couple lines of the original template.php after the hack are:

PHP Code:

($action=="customize"$action="add";

if (isset(
$action) and $action=="generate") {
  
$noheader=1;
}

require(
"./global.php");

adminlog(iif($templateid!=0,"template id = $templateid",iif($templatesetid!=0,"templateset id = $templatesetid",""))); 



ok, that explains a huge void here. You only added that chunk of code. I have two extra things that were supposed to be entered......this is my biggest bitch and complaint on some of these hacks...piss poor documentation.

I will give that a whirl FW, and if that doesnt do it, fuc* it..it gets ripped out.

FWC 08-27-2001 06:39 AM

Crap, I'm an idiot. I just found this part:

Quote:

find
###################### Start add #######################

add
makelabelcode("","$ButtonExtra");

right before
makehiddencode("group", "$group");



find
###################### Start edit #######################

add
makelabelcode("","$ButtonExtra");

right before
makehiddencode("group", "$group");

ToraTora! 08-27-2001 06:47 AM

Still nothing but errors...I reluctantly put this one away...I had the lines above added FW, ($button values)

and that is what was giving the errors. I took them out, everything worked fine..put them back in, and it wiped out my acutal vb buttons...so, this pain in the ass hack is being put to pasture with its lackluster documentation.

Again, I thank you for your patience and help FW, i really do

FWC 08-27-2001 06:52 AM

I'm sorry we didn't get it to work. It's frustrating. I do know I have to get some sleep.

ToraTora! 08-27-2001 06:55 AM

very frusterating.....
i cannot tell you in words how many times i have tried to get this thing to work, so there comes a time when you just have to say "fuc* it" lol...

ok, catch ya later, and again, thanks for the help.

Sleep....sounds like a good idea..


All times are GMT. The time now is 01:13 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.01356 seconds
  • Memory Usage 1,856KB
  • 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
  • (23)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (24)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