HTML call

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pat

    HTML call

    Hello,

    I have a question in regards to the use of php and html. The question
    is: can someone write a script separate from the html page and then call
    the script in like in a css style and use the values in the html page?
    If so how?

    I am just learning php and am not ignorant to programming, but I would
    use a function or created class in the separate file but how would you
    call the php file into the html file is what's killing me.

    I hope that makes sense and I hope someone can at least point me in the
    right direction to find the answer; because, to me putting all the code
    in an html document is redundant especially on the oop side.

    Thank you,
    Patrick
  • flamer die.spam@hotmail.com

    #2
    Re: HTML call


    Pat wrote:
    Hello,
    >
    I have a question in regards to the use of php and html. The question
    is: can someone write a script separate from the html page and then call
    the script in like in a css style and use the values in the html page?
    If so how?
    >
    I am just learning php and am not ignorant to programming, but I would
    use a function or created class in the separate file but how would you
    call the php file into the html file is what's killing me.
    >
    I hope that makes sense and I hope someone can at least point me in the
    right direction to find the answer; because, to me putting all the code
    in an html document is redundant especially on the oop side.
    >
    Thank you,
    Patrick
    You can include an html page into you php file, just by doing
    include("file.e xt"); you can't call php into html, im not sure exactly
    what you mean by use the values in the html.. you can set a variable in
    php, include an html page and within that html page have <input
    type='name' value=' <?php echo $something; ?>'>

    Flamer.

    Comment

    • bobzimuta

      #3
      Re: HTML call

      Pat wrote:
      Hello,
      >
      I have a question in regards to the use of php and html. The question
      is: can someone write a script separate from the html page and then call
      the script in like in a css style and use the values in the html page?
      If so how?
      >
      I am just learning php and am not ignorant to programming, but I would
      use a function or created class in the separate file but how would you
      call the php file into the html file is what's killing me.
      >
      I hope that makes sense and I hope someone can at least point me in the
      right direction to find the answer; because, to me putting all the code
      in an html document is redundant especially on the oop side.
      >
      Thank you,
      Patrick
      Easy way:
      Write all your php code and require the html file
      # test.php
      <?php
      $test = "Hi there";
      require_once( 'test.html' );
      exit(); // stop execution of script
      ?>

      #test.html
      <html>
      <body>
      <?php echo $test ?>
      </body>
      </html>

      Little more complicated, but worth it if you want to get into
      professional PHP development.
      Smarty - PHP templating engine


      1. Allows for logic in the template - Seperation of template logic and
      business logic
      2. Template caching
      3. Many more benefits, check out the documentation

      Comment

      • Jerry Stuckle

        #4
        Re: HTML call

        Pat wrote:
        Hello,
        >
        I have a question in regards to the use of php and html. The question
        is: can someone write a script separate from the html page and then call
        the script in like in a css style and use the values in the html page?
        If so how?
        >
        I am just learning php and am not ignorant to programming, but I would
        use a function or created class in the separate file but how would you
        call the php file into the html file is what's killing me.
        >
        I hope that makes sense and I hope someone can at least point me in the
        right direction to find the answer; because, to me putting all the code
        in an html document is redundant especially on the oop side.
        >
        Thank you,
        Patrick
        From HTML you can include a PHP file with SSI - Server Side Includes, i..e

        <!-- include file="myfile.ph p" -->

        See SSI documentation for your server for more information and/or follow
        up in alt.html.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • reb

          #5
          Re: HTML call



          Le 24/07/2006 23:43, Pat a écrit :
          I have a question in regards to the use of php and html. The question
          is: can someone write a script separate from the html page and then call
          the script in like in a css style and use the values in the html page?
          If so how?
          >
          I am just learning php and am not ignorant to programming, but I would
          use a function or created class in the separate file but how would you
          call the php file into the html file is what's killing me.
          >
          I hope that makes sense and I hope someone can at least point me in the
          right direction to find the answer; because, to me putting all the code
          in an html document is redundant especially on the oop side.
          You can call a php script from your HTML with an inline frame ; you'll
          get the generated content of the php file :

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
          <html>
          <head>
          <title>Test</title>
          </head>
          <body>
          <p>Lorem ipsum...
          <iframe src="test.php"> </iframe>
          </body>
          </html>

          Comment

          • Pat

            #6
            Re: HTML call

            Pat wrote:
            Hello,
            >
            I have a question in regards to the use of php and html. The question
            is: can someone write a script separate from the html page and then call
            the script in like in a css style and use the values in the html page?
            If so how?
            >
            I am just learning php and am not ignorant to programming, but I would
            use a function or created class in the separate file but how would you
            call the php file into the html file is what's killing me.
            >
            I hope that makes sense and I hope someone can at least point me in the
            right direction to find the answer; because, to me putting all the code
            in an html document is redundant especially on the oop side.
            >
            Thank you,
            Patrick
            Thank you everyone this helps me a lot.

            Thank you again,
            Patrick

            Comment

            Working...