News items

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

By Berkowitz - February 18, 2008 - edited: February 18, 2008

Hi,

I have 2 questions.

Number 1:

this is one of my test pages
http://www.1id.be/pages/Hardsoft.php

As you can see when you go to the page you have my menu on the left side and an iFrame on the right of it. When you click one of the menu items my pageviewer loads in my iFrame.

But when you get on the page my iframe is blank. Now my question is, is it possible to always show the first item of my menu in my iFrame.


Second question:

This is another test page.
http://www.1id.be/test.php

Here i'm showing a news item on my page and when you click 'meer info' (translation: more info) you just get a white page, which is normal since my pageviewer is a white page because again it's purpose is to be viewed in my iFrame. So what i want is that my link 'meer info' links like this:

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

with my news item loaded in my iFrame.


Thanks in advance
Berkowitz

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