Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: HTML - Open link and display specific content in the next frame  (Read 3300 times)

0 Members and 1 Guest are viewing this topic.

Tomwatts

    Topic Starter


    Rookie

    • Experience: Familiar
    • OS: Windows XP
    HTML - Open link and display specific content in the next frame
    « on: January 19, 2017, 04:48:04 AM »
    Hello,

    I have a small website where I am writing articles, i have the below code on page 1:

    <a href="./articles.php">Article Number One[/url]
    <a href="./articles.php">Article Number Two[/url]

    I would like both links to open the specific article in the page entitled article which has the below code:

    <iframe src="./articles/article_viewer" frameborder="0" width="75%" height="100%" name="articles_viewert"></iframe>

    How can i get it so when i click on Article 2 on page 1 it loads up the Article page then opens the article in the frame?

    Thanks,

    DaveLembke



      Sage
    • Inventor of the Magna-Broom 3000 =)
    • Thanked: 610
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: HTML - Open link and display specific content in the next frame
    « Reply #1 on: January 19, 2017, 05:51:02 AM »
    Did you write the php code or are you using php that is generated elsewhere?

    Dynamic HTML is the direction I feel your trying to go with this and running into your problems, so curious what your php code is doing if able to share the php here?
    Quote
    <a href="./articles.php">Article Number One[/url]
    <a href="./articles.php">Article Number Two[/url]

    articles.php is hyperlinked as the same php code for Article 1 and 2, so curious what your php code is to differentiate a user clicking on Article 1 vs 2. The way I see this you get the same result from clicking either link, so knowing what your php code is doing is needed for us to help further.

    Quote
    <iframe src="./articles/article_viewer" frameborder="0" width="75%" height="100%" name="articles_viewert"></iframe>

    Knowing what your php is doing we can better assist with this. There is a lot of dynamic HTML that is going on with your php or should be going on in your php to display what you want.

    Tomwatts

      Topic Starter


      Rookie

      • Experience: Familiar
      • OS: Windows XP
      Re: HTML - Open link and display specific content in the next frame
      « Reply #2 on: January 19, 2017, 06:37:18 AM »
      Hi thanks for the reply

      Ignore the fact that they're PHP pages, they're currently empty and could be HTML pages, i'm not too concerned about that.

      Just to clarify, what i'm aiming to do is this:

      1. I have a page called Home which contains links to my articles, lets say:
             Article 1
             Article 2

      2. When I click on one of the articles (lets say Article 2) it directs me to a new page called "Articles" and opens up the code in a <iframe> on that page called article_content.html.

      Thanks,

      camerongray



        Expert
      • Thanked: 299
        • Yes
        • Cameron Gray - The Random Rambings of a Computer Geek
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Mac OS
      Re: HTML - Open link and display specific content in the next frame
      « Reply #3 on: January 19, 2017, 09:31:56 AM »
      You would need to have some sort of URL parameter so the link to article one would be along the lines of "articles.php?article=article-one" then have something in article.php that reads this parameter and loads the correct article into the iFrame.

      It would be helpful if you explained what the actual project is in more detail and why an iFrame is required.  Using iFrames in this way is seen as very outdated and is generally classed as bad practice.  Iframes should only be used when there is a good reason to (e.g. including a piece of content from another website such as when embedding a video), they shouldn't be used as general page layout elements or anything like that.