MyBB Community Forums

Full Version: An ABSURD parsing error haunts me ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Prestory:
I added 1 videosite to the existing video options in the editor/parser and threw out the ones I didn't like...

I edited

inc/jscripts/editor.js
		// An array of video services to be shown (youtube, vimeo, etc) 
		this.videos = new Object();
		this.videos["flash"] = this.options.lang.video_flash;
		this.videos["tmtube"] = this.options.lang.video_tmtube;
		this.videos["vimeo"] = this.options.lang.video_vimeo;
		this.videos["youtube"] = this.options.lang.video_youtube;
So only these 4 appear in the editor, of course I also edited

inc/languages/english/global.lang.php
$l['editor_enter_video_url'] = "Please enter the URL of the video.";
$l['editor_title_flv'] = "Insert full URL of a .flv video";
$l['editor_title_youtube'] = "Insert full URL of a youtube video";
$l['editor_title_vimeo'] = "Insert full URL of a vimeo video";
$l['editor_title_tmtube'] = "Insert only the -Media ID- of a tmtube video";


$l['editor_video_flash'] = "Flash (FLV)";
$l['editor_video_vimeo'] = "Vimeo";
$l['editor_video_tmtube'] = "TM-Tube";
$l['editor_video_youtube'] = "YouTube";

and inc/languages/english/admin/global.lang.php accordingly.

inc/class_parser.php
			case "flash":
				$id = $url ; // http://vimeo.com/fds123
				break;
			
			case "vimeo":
				$id = $path[1]; // http://vimeo.com/fds123
				break;	

			case "tmtube":
				$id = $path[2]; // http://www.tm-tube.com/video/12345/title_goes_here/
				$title = htmlspecialchars_uni($path[3]);
				break;
	
			case "youtube":
				continued..............

inc/functions.php
			"editor_enter_video_url",
			"editor_video_flash",
			"editor_video_vimeo",
			"editor_video_tmtube",
			"editor_video_youtube",


And the result is pleasing, "tmtube" is now fully integrated into the TV-button. HeartHeartHeart

Example:
http://forum.mania-creative.com/thread-2558.html


But here comes the problem ....

This is the TEMPLATE
Ungrouped Templates/video_tmtube_embed
<hr>
<script type="text/javascript" src="http://www.tm-tube.com/js/embed.id.js.php?id={$id}&width=640&height=360"></script>
<hr>

Easy,eh ? But watch the OUTPUT @ http://forum.mania-creative.com/thread-2558.html

<br>
<br>
<hr>
<script src="http://www.tm-tube.com/js/embed.id.js.php?id=22045&width=640&height=360" type="text/javascript">
<script src="http://www.tm-tube.com/js/embed.js.php?key=1f1e822d79c75941f003&width=640&height=360" type="text/javascript">
<div id="flash_4e625dc788063">....[....]....</div>
<br>
<hr>

The additional script+div is not the problem, the embed.id.js.php does that and that's OK.

BUT WHERE DO THE ADDITIONAL <br> tags come from !??!
Not from the embed.id.js.php, that's for sure, I tested this in an empty HTML page....

1 <br> BEFORE the original HR tag and
1 <br> tag slips BETWEEN the script and the original <hr> tag

Random fact:
- Deactivating javascript for the site = same error = javascript not guilty.
- For test purposes, I deactivated ALL plugins = still the same error.
- If there is content AFTER the video embed tag, the AMOUNT of <br> tags that occurs, VARIES ... sometimes "it" inserts 3 <br> tags after the video (1 BEFORE hr and 2 AFTER)
- I only inserted the <hr> tags for TEST purposes only to realise that the <br> tags even appear BETWEEN the original script and <hr> tag of the template... Before inserting the <hr> tags into the template, "it" put 2 <br> in front of the script and 3 <br> after the script tags = even more absurd.

Question:
What part of the parser construction could be responsible for that ? It only happens with the newly inserted tmtube videos, NOT with youtube e.g...

Please help Undecided