Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Extended iFrames


Go to End


1026 Views

Avatar
steve_nyhof

Community Member, 224 Posts

17 May 2008 at 3:30pm

Some of my iframes include a script...

How can I add this to the iframes module, or is there another way? Without this ability, I can't use SilverStripe - and so far I really like it. Any help?
Thank you,
Steve

<IFRAME title="Search house plans and home plans" id=myFrame frameBorder=0 width=100% height=2000></IFRAME>
<script>
function decodeQuery(query)
{
var params = {}; // prepare the map
if (query.length < 2) // zero characters or single '?' means no parameters
return params;
// cut '?' away:
query = query.slice(1);
var paramList=query.split('&'); // separate parameters
for(var i=0; i<paramList.length; i++) // enumerate them
{
var pair = paramList.split('=');
params[pair[0]]=pair[1];
}
return params;
}

var query=location.search; // get everything after question mark
var params = decodeQuery(query); // and turn into an indexable structure
var p = (params.id) // checking if 'id' is present
? '&action=more_details&id=' + params.id // if present, then ask for more details
: ''; // otherwise - don't.
var iframe = document.getElementById('myFrame');

iframe.src="http://www.sneserver.com/houseplans/index.php?BuilderID=197" + p;
</script>