Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: 2 Questions

  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2 Questions

    Question number 1:
    Is it possible to use php in a html document?
    Question 2:
    I have an iframe that is quite large. At the bottom is a link to a diferent part of the site in the iframe. But unfortunatly, it stays at the bottom of the new page, so I have to scroll up to view the page. How do I make it go to the top of the page, while staying inside the iframe?

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    question 1:

    No. You CAN put HTML in a PHP file. You can switch between php and HTML like this:

    <?php

    //PHP Code

    ?>
    <!--HTML Code-->
    <?php
    //More PHP Code
    ?>

    ---OR---

    You can also echo HTML, like:

    <?php
    echo("<html><head><title></title></head></html>");
    ?>

    Remeber, quoted attributes need to be escaped.

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Darn, I hoped it was possible.

  • #4
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gamefreak11
    Question 2:
    I have an iframe that is quite large. At the bottom is a link to a diferent part of the site in the iframe. But unfortunatly, it stays at the bottom of the new page, so I have to scroll up to view the page. How do I make it go to the top of the page, while staying inside the iframe?
    Do you want a page to load in the iframe? To do that you can use the target attribute on an a tag (note that the target attribute is deprecated).

    Eg.
    Code:
    <a href="page.htm" target="iframename">Linky link</a>
    Please post back if I misunderstood you .

  • #5
    New Coder
    Join Date
    Feb 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, I see what you thought I meant.
    No, the link is accutally inside the iframe. When the user clicks the link in the iframe it goes to the different page inside the iframe, but appears at the bottom.
    Example:
    http://arcadetest.freecoolsite.com/Example.html

    When you go to the link "click here" it goes to a new page with Hello printed. But instead of going to the top it goes to the bottom where the link was. So you have to scroll up to see the text "hello".
    How do I fix this?

  • #6
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    I was going to suggest using
    Code:
    <a href="#here">link</a>
    
    <div id="#here"><p>where the link goes to</p></div>
    But I realize it's on different pages, and it might be another issue. I think some of the reason is that there is nothing to tell the page there's any real content on it, so it's not going to display from the top. Try using some tags, <html>, <body>, <p>, for examples.

    Edit: Oh, and check out this link: awesome link

  • #7
    New Coder
    Join Date
    Feb 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope, did not work. I added <html><body> Before the text and </body></html> after the text.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •