Using two words in html helpers

20 views
Skip to first unread message

LoveWeb2py

unread,
Nov 18, 2014, 5:57:44 PM11/18/14
to web...@googlegroups.com
How can I have two words in the html helper?

For example

<audio autoplay>

I'm trying to use tags and have tried using TAG.audio(str('content here'), _autoplay) but it treats autoplay as a variable at that point. When I try to set autoplay as a string it doesn't work.

Any thoughts?

LoveWeb2py

unread,
Nov 18, 2014, 6:03:25 PM11/18/14
to web...@googlegroups.com
Figured it out... sorry for the trouble. Here is the solution

TAG['audio autoplay']

If you use the dictionary format you can combine multiple values (as mentioned in the book)

Thanks!!

Leonel Câmara

unread,
Nov 18, 2014, 7:23:20 PM11/18/14
to web...@googlegroups.com
No no, don't do this, then it will close with </audio autoplay> which is not what you want, there are no HTML tags with two words. TAG.audio(_autoplay='autoplay') is ok and will work. Autoplay is an attribute, the reason you can use it without a value is because HTML allows attribute minimization. If the value there annoys you, you can use XML('<audio autoplay></audio>'), or just don't use a helper.
Reply all
Reply to author
Forward
0 new messages