PHP on HTML page? Vice Versa?

  • Jason7098
  • Born
  • Born
  • User avatar
  • Posts: 4

Post 3+ Months Ago

I want to read database data and display it on a webpage, but with the layout I have created in html.

Is there an easy way to do this without "echo" or "print"ing html content on the php page?

I also thought of using an iframe, but the size of the frame would need to decrease and increase with the content of the page, rather than becoming scrollable.

Any help? :S

A simple example of what I am trying to achieve can be found here:

jasonsportfolio co uk / uploadtest

except there is no massive amounts of html involved in these pages.

edit:

I also tried editing .htaccess:

"RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html"

but this doesnt appear to make a difference.
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

you don't have to print/echo all the html just the bits that change the rest can be static
like this (since I don't know what your doing I am showing what I have done for my site)
Code: [ Select ]
<div id="content"><h1><?php print $pageTitle ?></h1><?php
print $content ?></div>
  1. <div id="content"><h1><?php print $pageTitle ?></h1><?php
  2. print $content ?></div>
the <h1>,and <div> tags are not printed

as for using .htaccess removing php files support html but html does not alow php so make all you html files php
  • katierosy
  • Newbie
  • Newbie
  • katierosy
  • Posts: 6

Post 3+ Months Ago

You have to set Apache (or whatever web server you are using) to parse .html/.htm files with PHP.
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

katierosy wrote:
You have to set Apache (or whatever web server you are using) to parse .html/.htm files with PHP.

Since php will generate html I think that it should do what you want without any setting up.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 27 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.