Automatic Iframe creation
thet0olman - April 6, 2009 - 14:12
| Project: | insertFrame |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I would like to add a cck field where all the user has to do is specify the url of an external website and it will insert an IFrame of predetermined parameters. Is this something that might be simple to do?

#1
You can use contemplates in conjonction with CCK field to generate the body of the node with insertFrame tag.
#2
How might I acheive that code wise?
#3
So far I figured this much out:
<div class="field_myiframe"><h3>[Title]</h3>
<iframe src="[URL]" scrolling="yes" width="100%" height="1200" frameborder="0" ></iframe>
</div>
where URL is the machine name of the cck field I want to use to create the Iframe but it doesnt work. How do I get the value of the url field into the iframe?
#4
Contemplate can do that.
You can also create a function youthemeègetURL($url) in your template.php.
In this function, get the cck field from database
and return the value
#5
Im sorry Im not familier with php functions and how to connect them to drupal
Might it possible you provide me some sample code?
Sorry I dont want to sound like i want you to do the work for me I just dont have a clue where to start to figure this stuff out
#6
Hi,
Sorry for the delay but i came back from holidays
The best way to do what you want is to use conTemplate, CCK and insertFrame.
<?phpprint _insertFrame_getHTML($node->field_iframe_url[0]['view'])
?>
The frame will be shown with default values (height & width =100%, ...). You can add CCK fields to customize it. The parameter of the _insertFrame_getHTML function is what you usually type without [[[ and ]]]. (ie : www.google.com height=300px).
If you want more details, please contact me by email.
#7
this worked great, I have one more question though, Is it possible to do a normal frame? where as the top would be my website and the botton would be an external website? instead of embeading it into the page as an IFRAME? I cant even seem to get it to work just by trying to code it into contemplate.
#8
What do you mean by normal FRAME ?
You can modify node.tpl.php of your theme (into theme/youtheme directory) to insert a frame for all the nodes of the site
#9
I ment like a frameset, I cant get drupal to show one when i modify node.tpl.php
#10
Could you contact me by email and explain exactly what you want to do ?
#11