News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Personalized BBC

Started by Chen Zhen, June 03, 2014, 07:19:08 PM

Previous topic - Next topic

ambre222

Hello,
Thanks a lot for your mod. However I have an issue, it works but I have a lot of errors in the logs, all of the same kind "undefinded index"
8: Undefined index: board_name
/forum/Themes/default/languages/PersonalizedBBC.english.php (main sub template - eval?)
Ligne: 399
Or
8: Undefined index: member_name
or
8: Undefined index: topic
I have the version 1.93 (but with the version 1.92 it was the same) on smf SMF 2.0.15 for a french forum.
Thanks for your helop

njtweb

Did the type you chose include content & option, as shown above?

The mod has a handy test link. 

Again - we're now deep into how to use the mod - further discussion on how to use the mod should take place on the mod support thread - so other users of the mod (who will be much more familiar with it...) can help:

When I adjust by selecting content and option from the drop down nothing happens at all when I do the test.

Chen Zhen


I haven't updated this mod in a long time.
With version 1.93 the test feature needs some tweaking/changes for it to work properly.
Any javascript within the bbcode will not work with the test button but they will work just fine in your forum portal pages & posts/topics.
Until I update the mod you will have to test bbcodes containing javascript on either portal (html) blocks or posts/topics (-< ie. recycle bin).

Thanks for the feedback.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

-Rock Lee-

I leave the translation to Latin Spanish, anything you tell me (I think it serves you as much as 2.x as for 2.1 but let me know)!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Sir Osis of Liver

I've upgraded a very old forum from 1.1.12 -> 2.0.15, it was running Custom BBCode mod.  Found the tag code in the database, two fields -



<a href="#" onmouseover="forumCardNum('$1');">
<a href="javascript:opencard('card$2')" onmouseover="forumCardNum('$2')" onmouseout="UnTip();">$1</a>



It pops up a window on mouseover that contains an image.  Trying to get it working with Personalized BBC, no luck.  The javascript functions opencard(number) and forumCardNum(number) are in forumCode.js, which is located in account root, above forum directory, don't know how it's called.  Any way to make this work?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen


The first hyperlink is not closed therefore the XHTML you posted is not complete.




try
type: [tag=option]content[/tag]
parsing: none

$1 will be entered as {content}
$2 will be entered as {option}




If you ever need to use 2 options
try
type: [tag=option1,option2]content[/tag]
parsing: none      

$1 will be entered as {content}
$2 will be entered as {option1}
$3 will be entered as {option2}                  




Multiple content and/or options always require parsing to be set to none.
In some cases further control over a bbcode may require javascript therefore it is not difficult to achieve the desired result.
I do not have a copy of the js file to test this.
If you can not get it to work then post the js file & try to show me an example of how it should function.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen


ie. for this code (the hyperlink that is proper from your previous post):

<a href="javascript:opencard('card$2')" onmouseover="forumCardNum('$2')" onmouseout="UnTip();">$1</a>


.. the bbcode html should be entered like this:

<a href="javascript:opencard('card{option}')" onmouseover="forumCardNum('{option}')" onmouseout="UnTip();">{content}</a>

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Sir Osis of Liver

#87
If you go here and mouseover 'Jedi Valor' in first post, a window opens that should contain an image.  The archive doesn't have the image files, but production install does.  The js functions are in attached forumCode.js, which is one directory level above the forum.  Images are in /images directory off root (same level as /forum).  The code in your second post displays the link correctly, but nothing happens on mouseover.

These are the two tags I could find in the db -



variable value
customBBCode_tag_1 cardnum
customBBCode_before_1 <a href="#" onmouseover="forumCardNum('$1');">
customBBCode_text_1 <a href="javascript:opencard('card$2')" onmouseover="forumCardNum('$2')" onmouseout="UnTip();">$1</a>

customBBCode_tag_4 shipnum
customBBCode_text_4 <a href="javascript:openship('ship$2')" onmouseover="forumShipNum('$2')" onmouseout="UnTip();">$1</a>


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen

See this here...

customBBCode_before_1 <a href="#" onmouseover="forumCardNum('$1');">


It is incomplete because there is no closing tag for the hyperlink.
This is what I tried to tell you in my second last post.
Also show me the actual bbcode input in a code or quote.. I mean what is actually contained in a post using the tag.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen


The mouseover is working just fine as I have tested it with an alert.
The problem is that you are missing other javascript file(s).
The file you posted has several function calls that do not exist.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen

Alright after taking a look at things I can see you failed to include a file named wz_tooltip.js and this is why it also does not work on the forum link you provided.
That tooltip is available from the author here: Walter Zorn Tooltip.
That zip archive includes 3 files whereas for this example I am only using 1 of them because I am not sure if the other 2 are necessary for the task at hand.
Also it seems it will not work properly unless the script is able to resolve full url paths.

Keep in mind all this stuff you are using is archaic.
There are updated javascript and/or jQuery equivalents but that's up to you to pursue & use those.

I rewrote some of the script you provided and am going to include the one file you need to use it.
wz_tooltip.js is written in such a way that it will not function properly unless you include it directly after the <body> tag of the document.

Download the 2 files (wz_tooltip.js & forumCode.js) & place both of them in: ../Themes/default/scripts
ie. for the default theme...
file: ../Themes/default/index.template.php
find:

</head>
<body>


replace with:

<script src="' . $settings['default_theme_url'] . '/scripts/forumCode.js?v193" type="text/javascript"></script>
</head>
<body>
<script src="' . $settings['default_theme_url'] . '/scripts/wz_tooltip.js?v2015" type="text/javascript"></script>


.. unless forumCode.js is added differently ie. via $context['html_headers'] .. if so then ignore the first script tag before </head>

Here is the BBCode:

<a href="javascript:opencard('{option}')" onmouseover="forumCardNum('{option}')" onmouseout="UnTip();">{content}</a>


The file has been adjusted assuming ships.php is located in your main forum directory.
Also it was written such that forumGallery.php is located in ../Themes/default/scripts even though that is supposed to be for js files.
I did not change where it attempts to use those files from those locations.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen


Rock Lee,

Thank you for the translation files.
I will look them over and likely put them in the download section of my website.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Sir Osis of Liver

Thanks, Chen, I'll get to this tonight.  Still trying to figure out how it was working in original 1.1.12 install.  forumCode.js and ships.php are located one level above forum, they're not called in the forum code.  Don't see wz_tooltip.js or forumGallery.php anywhere, and there is no /Themes/default/scripts subdir.  The broken link is what's in the database for cardnum tag, and it was working that way.  I'm not attempting to rewrite the thing, just want to get it working in 2.0.15.  This was a disaster forum running on GoDaddy, they'd moved everything to different servers without advising owner, database was damaged, backups were lost.  I've recovered most of it, but there are a lot of really old customizations that were done by people who are no longer around.  Trying to fix as much as I can.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen


forumCode.js and ships.php are located one level above forum


It accesses ships.php via the url and of course same with loading the js file.
Therefore to have a site use it like that, SMF has to be installed on a sub-directory.
Unless you change it around a bit like I did & place those files in the appropriate directories then you can access those files from the forum directory as a base.
I don't know what is to be displayed as far as clicking the link and having it use the ships.php file.
If you want to have all the user info & such plus show the forum header & footer then it would be best to relocate that file to ../Sources then edit the menu array in  Subs.php to load it via the index.

Either way some of my subtle path changes to forumCode.js likely have to be readjusted & you need wz_tooltip.js for sure.
Changing those paths shouldn't be difficult for you to figure out by editing the file although I do not know your experience with adjusting (paths in) script files.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Sir Osis of Liver

Ok, got some of it working.  Had to correct paths to images in forumCode.js.  If you go here, the cardnums are working -



[cardnum=059]Lock it down[/cardnum]
[cardnum=088]C-3PO[/cardnum]
[cardnum=sv005]Fiesty R2-Unit[/cardnum]
[cardnum=081]2-1B[/cardnum]
[cardnum=065]Repair[/cardnum]
[cardnum=ga098]Rs-D2[/cardnum]
[cardnum=107]Genosis Droid factory[/cardnum]



but the shipnums are not -



[shipnum=o15]Tantive IV[/shipnum]
[shipnum=27]Redemption[/shipnum]



Tried this for shipnum, ng -



<a href="javascript:opencard('{option}')" onmouseover="forumShipNum('{option}')" onmouseout="UnTip();">{content}</a>



And if you go here and mouseover 'Jedi Valor', window opens but image is missing -



[cardnum=cwt26]Jedi Valor[/cardnum]



Haven't figured out what the prefixes before the numbers mean.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen


The BBCode works fine but I was not given specifics regarding directories.
I will send you a PM regarding what you are attempting to do.


My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen

#96
I attached a replacement file.
The paths have been adjusted and this time I included a function at the top to adjust those paths if need be.

The original script attempted to use a file which is throwing an error:
.../Script/forumGallery.php

Since you informed me that there is a similar filename located in the root directory, you can have it use that one in its stead:
.../gallery.php


If it is supposed to be using .../gallery.php then do the following edit:
find:

var galleryUrl = setCardPaths("openforumgallery", true);


replace:

var galleryUrl = setCardPaths("opengallery", true);



My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Sir Osis of Liver

Will try that.  Fixed some things in forumGallery.php, it loads part of the page now.  There's a problem in ships.php, it wants to connect to a nonexistent database.  There are 7 databases in the account, but not the one it wants.  Is that script used?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen

That file is called when one clicks on an image hyperlink.

BTW - I switched the argument within the file in the last post because you seem to be using ../Scripts/forumGallery.php


My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Sir Osis of Liver

FYI, got both the cardnum and shipnum tags working in Personalized BBC here, file attached.

"Even a blind pig occasionally finds a mushroom." :P

Thanks.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: