News items

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 18, 2008   (RSS)

Re: [Berkowitz] News items

By Dave - February 18, 2008

Hi Berkowitz,

>is it possible to always show the first item of my menu in my iFrame.

Yes, create a list viewer called "firstPage.php" (or whatever you like), have it show all the same fields as the "page viewer" and set the perPage option to 1. Then set that as the src of your iframe.

<iframe src="firstPage.php" ...></iframe>

That's one way to do it, let me know if that works for you.

>Second question:

I don't see an iframe on the test.php page? Are you wanting to open another page with an iframe and load the link in that?

Let me know.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] News items

Yes indeed. on my test.php there is no iFrame. But my link 'meer info' has to link to

http://www.1id.be/pages/NL/news.php

on that page there is an iFrame and the artikel should be shown completly there. On my test.php it's only a summary.

thanks for the help on my first question.
berkowitz

Re: [Berkowitz] News items

By Dave - February 18, 2008

If I understand correctly - it's really more of a html question. Which is how to load a page and then be able to specify the src of the iframe on the page (or iframe). We actually had the same problem when we had our docs in a frameset. We couldn't direct link to a specific page.

I've seen people do it with javascript and PHP. Here's a PHP way. You add this code to your page at the top:

<?php
$iframeSrc = @$_GET['src'];
$defaultSrc = "http://www.google.com/";
if ($iframeSrc == "") { $iframeSrc = $defaultSrc; }
?>


Then you add this to your iframe to set the src

<iframe src="<?php echo $iframeSrc; ?>" ... >

Then you'll be able to direct link to a iframe loaded within another page like this:

parentPage.php?src=iframePage.php

You'll need to url encode urls with special chars like & ? # etc in them. The best is probably just to experiment with some test pages and links to get it all figured out.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com