Page 1 of 1

{embed} vs {pi_iframe}

Posted: Tue Jun 19, 2007 7:37 am
by RonnyK
For a site i'm building I had to include another application with links included. I tried using "include", but that didn't hold the links as being relative to the included page, I then checked {embed} and {pi_iframe}.

Both worked, but with different issues being left, {embed} requires javascript and more importantly "kills xhtml validation", {pi_iframe} doesn't require javascript, but left a scrollbar for vertical scrolling, even thoug it wasn't required.

I then looked at the source of {pi_iframe} and changed the logic (found some logic in another post) to the code below:

""

This solved my issues as I didn't want scrollbars if they weren't needed, it validates and all relative links are shown in the same area, as it is an IFRAME.

I have set the height to be fixed through the CSS, as the scripts can't check the height on external pages (security reason), so my CSS is like:

Code: Select all

#myframe {
  height: 830px;
  width: 99%;
}
One other small remark, make sure you'll never put around the calling of {pi_iframe} as it kills validation of xhtml.

Ronny

Re: {embed} vs {pi_iframe}

Posted: Tue Jun 19, 2007 9:23 am
by wuschel
I mean the pi_iframe here is very old and not under support, i have find the latest:

Code: Select all

<?php
#PowerCMS
#PowerCMS (c)2006 by Jan Czarnowski  (piratos@coftware.de)
#This project's homepage is: http://powercms.org
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

function smarty_function_pi_iframe($params, &$smarty)
{
	
	if (!empty($params['url'])) $url = $params['url'];
	 else return "<pre>Falscher Aufruf von pi_iframe - url parameter fehlt!<pre>";
        $height = isset($params['height']) ? $params['height'] : '650px';
        $width = isset($params['width']) ? $params['width'] : '600px';
        $scrolling = isset($params['scrolling']) ? $params['scrolling'] : 'no';
        $frameborder = isset($params['frameborder']) ? $params['frameborder'] : 0;
        $marginwidth = isset($params['marginwidth']) ? $params['marginwidth'] : 0;
        $marginheight = isset($params['marginheight']) ? $params['marginheight'] : 0;
        $id = isset($params['id']) ? $params['id'] : 'pi_iframe';
        $sizing = isset($params['sizing']) ? $params['sizing'] : 0;
        $returnvalue = "<__iframe id='$id' src='$url' scrolling='$scrolling' marginwidth='$marginwidth' marginheight='$marginheight' frameborder='$frameborder' height='$height'width='$width' ></__iframe>";
        if ($sizing ==1)
          $returnvalue ="<__iframe id='$id' src='$url' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' style=".'"overflow:visible; width:100%; display:none"></__iframe>';
        return $returnvalue;
}
?>