SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: html & php

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up html & php

    I wish to use top, lower and right pages of php in my html site.
    is it possible?.................... How?
    Plz explain

  2. #2
    SitePoint Zealot cpace1983's Avatar
    Join Date
    Sep 2009
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your post doesn't really make much sense, do you mean like in an iframe, or just with a sidebar? Are these separate pages, or are you talking about building a single template?
    I am a Freelance Linux Consultant.
    I offer flat rate Linux support, as well as hourly support.
    Feel free to visit my blog, Ramblings of a Linux Administrator.

  3. #3
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it is possible. Give the html file the extension .php so the php-scripts in it will be parsed.

    Use include to add the html code parts where you want them. The include files must only have the code part that belong in that place of the page.

    Use relative file paths to the include files. To avoid revealing your scripts, a safety practice is to also name the include files as .php if they in turn inserts php scripts.

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Untitled</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    <meta name="generator" content="PSPad editor, www.pspad.com">
    </head>
    <body>
    <div id="wrapper">
    <?php include("top.php");?>
    <?php 
    include("right.php");?>
    <?php 
    include("lower.php");?>
    </div>
    </body>
    </html>
    Happy ADD/ADHD with Asperger's

  4. #4
    SitePoint Addict Avactis's Avatar
    Join Date
    May 2006
    Posts
    391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Erik J View Post
    Give the html file the extension .php so the php-scripts in it will be parsed.
    If the extension of the files will be changed to .php, the links to these pages could be broken.

    It is possible to run PHP on a .html pages. Try to modify the .htaccess file and add this line for .html:

    Code:
    AddType application/x-httpd-php .html
    Avactis Shopping Cart & CMS - Easy integration into existing
    site design. Ecommerce Hosting with Free support.

  5. #5
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Or you could use SHTML includes (using the MIME type on HTML) to eliminate the need to invoke the PHP engine just for the sake of activating some includes.

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I remember dreamweaver template functions, should be able to do so.

  7. #7
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Hi Friends
    Thanks for your replies and specialty thanks for dear Erik who guided me entirely.


Bookmarks

Posting Permissions

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