cant embed html in page? Options
feivi18
Posted: Friday, April 11, 2008 10:42:24 AM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
Hi everyone, a noob here!

I'm having trouble with some html I'm trying to add to a page. The code basically creates an iframe which displays xyz website. When I add the code, my page just shows up blank. If I add the same html to the template, it works fine.

Isn't what I want possible at the document level?

TIA!

Feivi
dawoe
Posted: Friday, April 11, 2008 11:08:26 AM

Rank: Aficionado

Joined: 1/19/2008
Posts: 170
Location: Belgium
feivi18 wrote:
Hi everyone, a noob here!

I'm having trouble with some html I'm trying to add to a page. The code basically creates an iframe which displays xyz website. When I add the code, my page just shows up blank. If I add the same html to the template, it works fine.

Isn't what I want possible at the document level?

TIA!

Feivi


Where are you trying to add it ? In a RTE in your document, macro,... ?

Converting a DotNetNuke site to Umbraco : Follow it here
feivi18
Posted: Friday, April 11, 2008 12:18:55 PM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
That's right, RTE in the document. The code, btw is as follows:

<iframe src="http://www.forbes.com/" name="float1" width="650" height="398" align="left" id="float1"></iframe>
sjors
Posted: Friday, April 11, 2008 1:13:51 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 408
Location: Amsterdam
feivi18 wrote:
That's right, RTE in the document. The code, btw is as follows:

<iframe src="http://www.forbes.com/" name="float1" width="650" height="398" align="left" id="float1"></iframe>

Maybe try to put it in using the HTML editor in the Rich Text Field
Petr Snobelt
Posted: Friday, April 11, 2008 1:14:27 PM
Rank: Aficionado

Joined: 10/2/2007
Posts: 165
Location: Czech Republic
RTE editor filter some elements and it's not good solution to add iframe into RTE.
Create another (string) property paste iframe code into and use it in your template.

Or better create special datatype for iframe pages with properties like iframe url widt and height etc.

Petr
feivi18
Posted: Friday, April 11, 2008 2:39:48 PM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
Sjors, I tried that, didnt work.

Petr, the problem with using the template is that I want several pages, each with a different site embedded. If I go with templates, I will have to create a seperate template for each page, no?

Feivi
bwakkie
Posted: Friday, April 11, 2008 2:46:44 PM

Rank: Devotee

Joined: 7/6/2007
Posts: 69
Location: Brussels
feivi18 wrote:
Sjors, I tried that, didnt work.

Petr, the problem with using the template is that I want several pages, each with a different site embedded. If I go with templates, I will have to create a seperate template for each page, no?

Feivi


Best create a macro with the new url as macro parameter ... something like:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>
<xsl:param name="url" select="/macro/url" />

<xsl:template match="/">

<!-- start writing XSLT -->
<iframe name="float1" width="650" height="398" align="left" id="float1">
<xsl:attribute name="src">
<xsl:value-of select="$currentPage/data[@alias = $url]"/>
</xsl:attribute>
</iframe>
</xsl:template>

</xsl:stylesheet>


^(B(astia{2}n)?)(\s)?(W(ak{2}ie)?)$ IRC --> irc://irc.freenode.org/umbraco
feivi18
Posted: Friday, April 11, 2008 4:42:33 PM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
Bwakkie, thanks, I appreciate the help, but it seems I need some more of it! I created the xslt file, and the macro that refers to it. But trying the macro both in the template and the RTE itself didnt work... Did I mention I'm a newbie :-(?

TIA

Feivi
Petr Snobelt
Posted: Monday, April 14, 2008 9:00:54 AM
Rank: Aficionado

Joined: 10/2/2007
Posts: 165
Location: Czech Republic
Hi, If you don't need your iframe inside other custom text, you don't need macro.

Just create new DocumentType (iframePage) with mandatory string property iframeURL.
Then create template which use this property.

something like this
<iframe src='<?UMBRACO_GETITEM field="iframeURL"/>' width=50 height=50 />

Then create iFramePage, set url and I hope everything works as you wish
feivi18
Posted: Monday, April 14, 2008 10:27:32 AM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
aye, there's the rub, I DO need it with other content :-(. But I'll try it anyways, just to know if it works!
sjors
Posted: Monday, April 14, 2008 11:54:40 AM

Rank: Fanatic

Joined: 7/20/2006
Posts: 408
Location: Amsterdam
I had in the past problemls pasting some HTML elements, especially stuff with script blocks in it.
feivi18
Posted: Monday, April 14, 2008 1:10:06 PM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
Is anyone from the developer team following this thread? It's kind of heard to work with a cms if the RTE is wishy-washy. The point of Umbraco is to make things easier, not harder, and the moody RTE is definitely not helping in that regard...
Simm
Posted: Monday, April 14, 2008 4:42:27 PM

Rank: Fanatic

Joined: 7/22/2006
Posts: 255
Location: Randers, Denmark
feivi18: The code for the RTE is open, so you can make the modifications yourself if you wish. I think the reason for not being able to use IFRAMES from the RTE is by design. Include them in the template or an XSLT-file is a far better choice. And if you want maximum flexibility create a textstring property like the other guys suggest :)

Best Regards
Simon

Simm.dk - My base on the web - proud Umbracian since 2.0 Beta
feivi18
Posted: Monday, April 14, 2008 9:40:35 PM
Rank: Newbie

Joined: 4/11/2008
Posts: 9
Simm, is there a way to create a page with a textstring property but to still be able to mix the iframe with other content? My main issue is that I want to have several different pages, each with a different iframe and different content.

TIA
Petr Snobelt
Posted: Tuesday, April 15, 2008 9:25:48 AM
Rank: Aficionado

Joined: 10/2/2007
Posts: 165
Location: Czech Republic
You can have iframePage as I suggest with other content, just add property like beforeIframe and afterIframe for example.

or you can workaround striping some tags (iframe, scriptblock etc) from your html by temporary disabling timyCME. If in developer -> datatypes -> richtext editor you switch to something other then timymce you can insert your html as you want.
Save and publish and then switch it back to timyMCE
Prle
Posted: Saturday, April 19, 2008 1:38:16 AM
Rank: Newbie

Joined: 6/29/2007
Posts: 24
Location: Zagreb, Croatia
Create a new macro and in it create 3 parameters "location", "width" and "height".
Check the "Use in editor" checkbox. Now create a xslt that looks something like this:
Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:variable name="location" select="/macro/location"/>
<xsl:variable name="width" select="/macro/width"/>
<xsl:variable name="height" select="/macro/height"/>

<xsl:template match="/">
<iframe src="{$location}" width="{$width}" height="{$height}"></iframe>
</xsl:template>

</xsl:stylesheet>


Use this xslt with your macro. Now when you want to add an iframe somewhere in RTE just click on the "insert/edit macro" icon in the toolbar.

I think this is just what you need.
mrshrinkray
Posted: Wednesday, May 07, 2008 9:00:38 PM

Rank: Aficionado

Joined: 8/4/2006
Posts: 106
Location: London
Macros store their data inside an attribute. That's going to break as soon as he adds quotes to his source.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.