Recent Topics

1 Mar 09, 2006 18:10    

I recently wanted to post a video that I found from Google Videos on my blog, yet it kept saying that the <embed> tag was illegal. After a little research, and lack of documentation, I hacked around in the _formatting.php file and found a solution.

Anyone who wishes to see the results check out:
http://www.digital-play.com/

Anyways, here is how you do it. * Note: I am running 1.6 Phoenix Alpha *
I believe that the config files are relatively similar but when giving specific line numbers, then may be off.

Begin by opening the file "_formatting.php" and scrolling down to line 163.

This line should read

'p' => E_Iinline, 

Change it to

 'p' => E_Iinline . ' embed', 

This change makes it so you have to put all

<embed>

tags inside

<p>

tags.

Next, scroll down to line 279. The line should read:

'td' => E_Flow,

Add an empty line after this line and type the following code:

'embed' => ' style id align type src allowScriptAccess quality bgcolor scale wmode salign',


Also, add any other properties of the embed tag that you need to use here.

Now, scroll down to line 310 which should read:

'td' => A_attrs. ' abbr axis headers scope rowspan colspan'.A_cellhalign.' ' .A_cellvalign,

Add a line right after it and add the same exact code you added above on line 280.

And that should do it!
Now you can use the embed tag on both strict and transitional with the properties you specified!

I'm sure there is a better way of doing this where it does not have to be wrapped with the 'p' tags. If anyone finds a way please let me know.

Jason Palmer
Webmaster Digital-Play Web Designs
http://webdesign.digital-play.com/

2 Mar 10, 2006 04:49

The <embed> tag is deprecated in XHTML.

YES ... you can embed <embed> into _formatting.php, but really, you should pull of the "XHTML valid" sticker then too.

If you can manage to both USE <embed> and validate, then I'll be impressed. :)

I don't know ... does "transitional" still allow <embed> ?

3 Mar 10, 2006 05:54

I just wanted to post a movie that I found :(
I suppose I could convert over the old embed tag in the code to display to movie to object. Then it would validate without any hacks. But for those of us who still would like to use the embed tag, even though it is not valid xhtml, then the hack above will allow you to.

Jason Palmer
http://webdesign.digital-play.com/

4 Mar 10, 2006 17:52

I hear you, believe me. Why can't one just paste in a video and blog about it? All this extra work seems, well ... unecessary!

I just wanted to point out the validation issues with <embed>. Seems to me you have a choice - work at validating (use <object> instead) and leave the "valid-XHTML" on your page - or pull the "valid-XHTML" and stick with <embed>.

We generally convert the video format from a browser-specific format (generally a Microsoft flavor) to a more universally supported, 3rd-party format (like Flash). Once converted, we've been able to use the <object> tag and keep XHTML-validation.

Just some thoughts.

5 May 07, 2006 18:15

I add everything that needs to add in the formatting.php but still doesn't work, can anyone put a copy of the php for reference?

6 May 07, 2006 18:21

Saliko,

What I would recommend is this ...

1) Turn off the HTML-checker in _formatting.php and get the <embed> code to work in your post, like you like (test in a couple of browsers ... say IE and Ffox). When you have it working the way you want ...

2) Come back here and post the HTML that you've used inside your post.

3) I'll then make a test post in a DAWN version - using your pasted code -(I assume you're using 0.9.1?) ... then I'll post the PHP code you'll need to add to the _formatting.php file so that it will work with the HTML checker.

How does that sound? ;)

Oh ... a link to your post/site would help too (if you haven't already done it).

Cheers,

7 May 07, 2006 18:30

Thanks for your reply!

Since I am new to the php, I might need more guide on it. I want to put my video on the blog. the script I want to put as follows:

<EMBED SRC="http://salinko.com/MV/shangri-la." WIDTH="352" HEIGHT="288"
AUTOSTART="1" SHOWCONTROLS="1" LOOP="-1">
</EMBED>

I have made the amendment on the formatting.php follow the instruction on the above post but it gave me the following error:

Tag embed must occur inside another tag
Tag embed may not have attribute SRC
Tag embed may not have attribute WIDTH
Tag embed may not have attribute HEIGHT
Tag embed may not have attribute AUTOSTART
Tag embed may not have attribute SHOWCONTROLS
Tag embed may not have attribute LOOP

did I do something wrong?

8 May 07, 2006 18:47

Saliko,

There is a reason I asked for you to turn off the HTML-checker FIRST, before posting the code.

(To turn it off, edit the _formatting.php file change

$use_html_checker = 1;

from a "1" to a "0" ... it's near the top of the file.)

This way ... you can bypass the checker (you will no longer get errors) and what you write in your post will be saved and you can check it online, to make certain that it's doing what you want.

For starters, your src doesn't have a file extension. What type of file is "shangri-la."? MOV, WMV, AVI ??

Second, <embed> is generally enclosed in <object> tags.

So ... BEFORE you worry about your formatting.php file and the html-checker, you need to be certain that the code you WANT to post, will actually WORK.

Get it working FIRST. Then we'll worry about the PHP code in the _formatting.php file and the HTML-checker.

Still need to know what version of b2evo you're using AND get a link to your site/page. ;)

10 May 07, 2006 19:44

OKAY ... step 1 complete! ;)

Looking at the source, it appears that you are using the following HTML code:

<p><embed SRC="http://www.salinko.com/MV/shangri-la.wmv" WIDTH="352" HEIGHT="288" AUTOSTART="1" SHOWCONTROLS="1" LOOP="-1"><br />
</embed>
</p>

I'll add it to my DAWN install and tell you what you need to do for your _formatting.php file so that you can insert such videos without getting errors. :D

You can see your hotlinked video on my test [url=http://www.randsco.com/blogD/index.php/2006/05/07/adding_the_embed_tag_to_b2evolution]HERE[/url] :p

11 May 07, 2006 20:11

Saliko,

Got it. Here are the instructions you need, with the reasoning behind it.

Whenever you add tags to the formatting file, you need to consider three things ... (a) The tag (b) its allowed sub-tags (if any) and (c) its attributes.

(1) Because your <embed> tag is INSIDE of a <p> tag, it's a new subtag for <p> ... so the first step is to allow it as a subtag. To do this ... find

'p' => E_Iinline,

and change it to

'p' => E_Iinline.' embed ',

(make sure it's the original COMMA after E_Iinline is changed to a PERIOD)

(2) The next step is to ALLOW <embed> as a tag (and in this case, it doesn't have any subtags). Find the last tag definition in the array <td>

	'td' => E_Flow,

and add a new line under it

	'td' => E_Flow,
	'embed' => E_Iinline,

(3) The last step is to DEFINE the attributes of your new tag. This is done in another array, the very next array down from your last change. Again, go to the last line, which is an attribute definition list for the same <td> tag. Look for

	// 'td' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign,	// Strict
	'td' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign.' nowrap bgcolor width height',	// Transitional

and add the new line below ... so that it looks like this

	// 'td' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign,	// Strict
	'td' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign.' nowrap bgcolor width height',	// Transitional
	
	// add embed subtags
	'embed' => A_attrs.' src width height autostart showcontrols loop ', 

(4) Save the file and upload it to /conf/_formatting.php (don't forget to turn the HTML-checker back on).

(5) Note that all of the attributes are LOWER CASE? You'll need to change you post HTML so that they match (XHTML uses lowercase attributes and tag names and I'd recommend you get used to it).

Your new HTML would look like this

<p><embed src="http://www.salinko.com/MV/shangri-la.wmv" width="352" height="288" autostart="1" showcontrols="1" loop="-1"><br />
</embed>
</p>

BOOM! You should be all set!

Hope this helps.

12 May 07, 2006 20:13

Thanks~ will wait for your result.

btw, may I ask one more questions? I saw some of the post have the link /.../.../xxx.wmv. how can I do this? is it very difficult?

13 May 07, 2006 20:24

I think I got it...... Thank you very much!


Form is loading...