PDA

View Full Version : How to use vbuletin wysiwyg in a parent directory of the forum one


Akex
02-01-2005, 11:16 AM
Hi,

Well, i'll try to explain my problem.

I'm trying to make a php script whch allows the use of the wysiwyg editor in a parent directory of the forum one.

So Everything loads ok, I have something similar to the code given in this thread

https://vborg.vbsupport.ru/showthread.php?t=66895


In order to make the editor work, I did a str_replace (or eregi_replace) for the $messagearea var, to replace relative urls (clientscript/... and images/...) into real urls ($vboptions[bburl]/...).

Now, in the source code of the html page generated the urls of called javascripts and images are fine (the editor loads with pitures ... ).

The probleme : it's for me impossible to write any message (impossible to have the cursor in the message area) and impossible to click the B, I, U ... buttons.


So, how to make it work ? (without copying the clientscript directory in the root folder ).

Thank you for any help.

noppid
02-01-2005, 03:44 PM
Hehe, I just took the time to learn this last night.

Assuming you can handle your paths to the JS...

1) check your body tag
2) check your form tag
3) check for define('GET_EDIT_TEMPLATES',
4) check your $phrasegroups = array(
5) check your $specialtemplates = array(
6) Check your requires, there are several needed.

For the proper configuration to get those controls going.

Look at the code for editing a signature, good clean easy example.

Akex
02-01-2005, 05:18 PM
1) check your body tag - $onload
2) check your form tag - ok
3) check for define('GET_EDIT_TEMPLATES', - true
4) check your $phrasegroups = array( - ok
5) check your $specialtemplates = array( - ok
6) Check your requires, there are several needed. -ok


Everything is ok, as the page works when in the forum directory but not when in the parent directory.

noppid
02-01-2005, 07:04 PM
There are solutions, but not knowing what your code is on the php page in use, I'm not sure how to implement a fix or suggestion.

Akex
02-01-2005, 07:30 PM
Here is the code with comments for filed in address http://www.yoursite.com/dir1/dir2/ and forum called this way : http://www.yoursite.com/forum/


<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
define('GET_EDIT_TEMPLATES', true);

//specialtemplates are called in another file as this one is called in require_once
//ie : 'smiliecache' and 'bbcodecache',



// ######################### REQUIRE BACK-END ############################
//file in root/dir1/dir2/ and forum files in root/forum/
chdir('./../../');
require_once('./dir.php'); //contains path information
if (forum) {
chdir(forum);
}
require_once('./global.php');
require_once('./includes/functions_newpost.php');
require_once('./includes/functions_editor.php');


$textareacols = fetch_textarea_width();

construct_edit_toolbar($newpage['message'], 0, 0, 0);

$subject = $newpage['title'];

//replace js call
$messagearea=eregi_replace("href=\"clientscript","href=\"" . $vboptions['bburl'] . "/clientscript",$messagearea);
//replace pictures call
$messagearea=eregi_replace("src=\"([^(http)])([^>]*)","src=\"" . $vboptions['bburl'] . "/\\1\\2",$messagearea);

eval('print_output("' . fetch_template('template') . '");');
}


?>

Akex
02-07-2005, 12:50 PM
Nobody can help :( ?

Thanks :)

noppid
02-07-2005, 05:40 PM
Not sure what to tell ya, but something is missing. Posting Phrases seem missing?

BTW, you are only handling Enhanced mode text.

Akex
02-07-2005, 07:25 PM
Well, I said : with this script it works when in the forum directory but not in the parent.