Jimmy
Mar 23 2007, 10:13 AM
Whilst searching around for help to setup cutenews blog I came across a way to use php in html pages - lo and behold it works! so I thought I'd share it with you all (Unfortunately I can't remember the site so I wrote this up a couple of minutes after I did it:) ). This method requires a web server with apache installed. So, luckily for us all this covers the whole of Trap17... even Qupis Just to make the point, this is in no way a difficult task and it doesn't require you to change your pages at all and you don't even have to rename them .php. (This works for web files saved as both .htm and .html) So Step 1 - Find the .htaccess file in the "public_html" root directory on your server. Step 2 - Now, open the .htaccess file here with notepad - you can use the cpanel editor too - and add the following code to the file: (If the file is not there create a new, empty file in notepad or another text editor and save it as ".htaccess" - Upload this and continue  ) (If like me you have never done anything with this file it should be empty) CODE RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html Step 3 - Save it and your done! Thats it  Now whenever you need to use php code, simply write it into the document and it will recognise the content as php and use it as you intended! This is a sample code of what you have to do in your page... Nothing! Simply put the code in and Bob's your uncle >:) CODE <html> <head> <title>Php Test Page</title> </head> <body> <div> <?php echo "This Really Does Work!"; ?> </div> </body> </html> And the best thing is... Your html pages still validate! so you don't have to decide between ease of use and getting you pages to validate; you can have it all  Hope this helped someone out.. It certainly helped me out
Reply
jlhaslip
Mar 23 2007, 03:41 PM
Good job, Jimmy... And here are a couple of links to Trap17 Tutorials which are related to this Topic. The following Tutorials share information about how to set up an Apache server onto your local machine which saves you from having to use the Trap or Qupis facilities to test your PHP code. http://www.trap17.com/forums/index.php?sho...32&hl=XAMPPhttp://www.trap17.com/forums/index.php?sho...17&hl=XAMPPThe XAMPP package includes Apache, MySQL, PHP4 and PHP5, Perl and several other softwares. (PHPadmin, an FTP server and a Mail Server, for instance) In fact, you can duplicate the entire Trap17 server set-up on your Localhost. Saves quite a bit of time and hassle since you don't need to upload all of your test cases.
Reply
dotasif
Mar 23 2007, 06:12 PM
That is excellent I cant believe this…..it works……as I post just 15 min before I write this ….that I cant work php code on quips now…..after I see your solution I used it ….and it works. Ohhhhoooo.. This forum is really helpful as Im new here…. Thanks I really mean it….
Reply
shadowx
Mar 23 2007, 06:55 PM
im surprised this works but i believe all of you! if im right its the same code that goes into .htaccess as that which makes the dynamic signatures with the ip's and browser info etc... but i would have thought that as it is treating HTM pages as php ones that it would throw an error when you use raw HTML as a normal php file would as its not the right syntax. Anyone know why it doesnt throw an error? or maybe it does but no-one mentioned it and i havent tried it myself
Reply
jlhaslip
Mar 23 2007, 07:40 PM
The php parsing must be invoked by the php start and end tags, otherwise, the php parser treats all files as html, so re-directing html files through the php parser is no big deal. Although it does add an additional step to the throughput, so the delivery of the page is *somewhat* slower. Unless you are parsing 100k files with mega database calls, you'll not notice the change, but it is a little more demanding of the Server resources.
Reply
Tetraca
Mar 23 2007, 09:47 PM
It's not really good to do that. It's better to have a PHP file with a header and a footer of HTML included so that you can make universal changes to your site, and not have to deal with modifying multiple files just to get the template working unless you deal with JS and CSS files.
Reply
jlhaslip
Mar 23 2007, 09:55 PM
That's the thing, Tetra, you can do exactly what you are saying, only with an html file extension if you add the posted code into your .htaccess file. The file contents would be the same whether you use the php or html file extension. It just conceals the fact that there is a php script running because when someone looks at your URL, it appears to be an html file.
Reply
Jimmy
Mar 23 2007, 10:00 PM
QUOTE(Tetraca @ Mar 23 2007, 09:47 PM)  It's not really good to do that. It's better to have a PHP file with a header and a footer of HTML included so that you can make universal changes to your site, and not have to deal with modifying multiple files just to get the template working unless you deal with JS and CSS files. Hmmm... the thing about this was if you have a html page, and you need to insert a small bit of php, instead of forcing you to change everything to xhtml standard or re-write your site as php and put it in, you can simply do this and it will work fine. As above, you're really describing the same thing, just in a different way (where it can be done with .htm and .html files instead of php files with a different extension) ! As Jim said, It would technically make everything slightly slower, but unless your pages are > 100K and your querying huge databases, you really won't notice the difference  Dotasif: Glad I could be of help ! Its really nice to know someone benefited already from this  Shadowx: Nope, it gives no error (that I'm aware of!!) And simply does what it says on the tin  .
Reply
jebriggsy
Mar 29 2007, 01:55 PM
Or you could've just renamed the file.html to file.php and added the php script  As long as the output HTML is good it won't affect anything whatsoever... The only useful thing I can thing of that comes out of this is hiding the fact that you're using PHP. But I don't see the point because if you know PHP that means you're more skilled than someone who just knows HTML... Now if you're doing that to get rid of file.php?this=that&that=this, I can see what you're getting at with SEO. But why not just use mod_rewrite instead?
Reply
shadowx
Mar 29 2007, 04:28 PM
Ah well, corrected i stand..or sit.. I suppose one advantage is if a potential hacker...if you can call them that... sees a php page they know that there is a chance for user input and database and more potential fr an exploit perhaps. I know that static HTML pages are only really vulnerable if someone gains your login details or access to your server whereas anything taking input, like php pages is vulnerable...though seeing a login box or something would obviously show sme server-sides are in use. And it would help in SEO for the reason above but would it also help in that the search engine thinks its looking at HTML pages and better indexes the content? Im probably wrong because ive not really dont any SEO in any detail and i havent much idea how a search engine works other than the basic explanations.
Reply
Recent Queries:--
pages - 18.99 hr back. (1)
Similar Topics
Keywords : php, code, html, pages, minutes
- [aef] Most Recent Topics Listing Mod
on your Web-site pages (2)
Create Dynamic Html/php Pages Using Simple Vb.net Code
Taking your application data, and creating a webpage for others to vie (1) This example will show you how use a string in VB to create PHP code. In order to do this, you need
a string to store your PHP page and a function that I will list at the bottom of the page for you to
put in a module. This code is written in VB.NET Public Sub CreatePage(ByVal HTMLTitle As
String, ByVal HTMLText As String, ByVal HTMLFileName As String) Dim strFile As String '
---------------------- ' -- Prepare String -- ' ---------------------- strFile = "" '
-------------------- ' -- Write Starter -- ' -------------------- strFile = " " ....
Add Flashing Inbox To Invisionfree Forum
Html code for invsiionfree!! (2) Do you find it annoying when you are on your invisionfree forum, and you get a new message, and it
ends up taking you 5 minutes to notice? This code makes the inbox link flash bold red saying how
many messages you have. In version 1 the word inbox stays the same, and doesnt change at all (for
Example this is flashing: Inbox (2) In version 2 (the second code) the word inbox changes to
messages (constantly, so that if you have none, it says messages (0) instead of inbox (0). It still
flashes Red Put the following In the Header and Body Section (Admin Cp>>>Skinning ....
How To: Html Tables.
I find these really useful. (8) If you are a novice web designer, but want your site to look advanced and proffessional, then what
better way to do so than to use HTML tables? HTML tables are a really easy way of formatting your
text, to make your ste look proffesional. It looks good, and its easy, what more can you ask for?
You have to use the tag, so first lets start off with: HTML Table > /table > In
between theese two tags, we will add the data for the table, using the tags and . =Table
Heading (Title) =Table Data (what you want in the table) =table row (new row) So, lets ....
Simple Javascript And Password System
How to protect your pages with password (9) The quickest way to get a password protection system up and running is to use a Prompt box in
JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
what the password should be, could even be one each, that can be sorted out at the next page then
pass the "input" directly through the url by changing the .href, like
http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
the referring page, and three fails from an IP if you like the php (the next page): CODE
<?php // processdo....
Php--> Content-only Pages
Create easy to edit php pages. (9) Description Learn to create easy to edit content-only pages with php. By parsing your layout into
your pages, you can reduce file sizes and files will become much neater. Try it out Ok, lets
start by creating a file called template.php. CODE <?php
//--------------------------------- //Layout top section //---------------------------------
$top = <<< html <!-- include HTML header code here --> <body>
INSERT CODE FOR [b]TOP[/b] OF LAYOUT HERE. html;
//--------------------------------- //Layout bottom sec....
[php] Clean Code Functions
Clean up your html output from php scripts (5) There is another Topic about writing 'clean' HTML code posted elsewhere on the Forum.
I'll edit this Topic and add the link so you can review it on your own, and there is no need for
me to comment on it in this thread, but the purpose of this Topic is to introduce a pair of
functions which can be used for making sure that the HTML output from my scripts is readable when a
view-source is reviewed. Two handy functions are included here. They work together quite nicely,
and I will start this Tutorial with a short summary of the reasons for their 'being....
Cakephp On Ubuntu
using your own public_html folder (0) Hi, there are many tutorials about this, but i would like to type the steps i followed in order to
get cakephp working on my user public_html folder. as many of you probably know, if you have
apache's userdir module loaded, you can put your web pages on /home/user/public_html , and
access them with the url: http://localhost/~user/ . I really prefer this, so all my web pages are
on my personal home, but how to configure cakephp to work with these paths, i got a hard time with
this, but finally got it!. here's how: in case you don't have apache2's u....
Html Span
(7) HTML Span Description The span tag is quite the handy tag to have at your disposal. You can use
it for everything from Text Formating, to creating a scrollable text area. When combined with CSS it
becomes an easy-to-use tool for making your website as uniform as possible, as your not bogged down
with tags for every heading and title on your website. Try It Out CODE <html>
<body> <div class="content"> <span class="heading1"> Heading
or title goes here. </span><br><br> All the content insi....
Html Bdo...
(13) Description I find that it is often difficult to write a sentence backwards, but thanks to HTML, I
can now complete this task in only a few seconds. Now the only problem is it is very difficult to
read... Try It Out Welcome to one of the most useless functions of HTML. The tags enable you to
write a sentence backwards. The code is quite simple. CODE <bdo dir="rtl">I
find that it is often difficult to write a sentence backwards, but thanks to HTML, I can now
complete this task in only a few seconds. Now the only problem is it is very difficult to r....
Want-to-start Html Tutorials
An HTML tutorial that covers the basics (2) NOTE: Don't use a rich text editor* for writing HTML code! Use Notepad in Windows,
SimpleText in Mac or TextEdit in OSX, but you must set the following preferences for the HTML code
to work! In the Format menu, select Plain Text. Open the preferences window from the Text
Edit menu, then select "Ignore rich text commands in HTML files." Start Creating Your Own HTML
File You can either use HTM or HTML file extensions. For more information, visit:
http://filext.com/file-extension/htm for HTM or http://filext.com/file-extension/html for HT....
Creating Navigation For Html Websites
Have a common navigation menu for the whole website! (12) Pre-requisite: HTML, inline frame tags 1 Attachment(.zip) included. Updates : 29-12-07: Doctype
added in example files (Advised by jlhaslip) Designing a whole website takes a lot of planning
and organization. Designing a proper navigation system is a basic step in building your website. If
you are developing webpages in html you would have observed that as you go on creating pages it
becomes difficult to maintain the links to the pages. This article will guide you in developing a
common navigation menu for your website. It describes three ways, so if you don'....
Create A Simple Html Editor With Php And Javascript
(3) Ok, I will teach you how to create a simple HTML editor that runs online with buttons that add HTML
tags. Before we start: You should have basic knowledge of these languages. HTML/XHTML
Javascript PHP You will need Ability to use filesystem functions. Chmodding abilities
Features of Editor Online PHP safe Full HTML support A Few Bad Features Can only create new
documents or overwrite Fairly unsafe Now we are ready to begin. The PHP Script This will be
our PHP script that we will use to make the file. Make a file called save.php Here is the....
Nice Clean Php Layout Coding.
Learn a nice neat way to code your layouts with php (7) There are basically two main ways to code your php. Method 1) Creating a php document with an html
look. The you throw in include tags all over the place. Its unorganized, and you have lots of stray
files hidden in folders and scattered in your base directory. Its difficult to organize, and you
make mistakes easily. Example: This document would be called index.php Whatever
Banner or something Some content here. Mostly along the lines of You might ask what
the problem was? Well, those include tags tend to multiply, and so do all those unne....
Html Legend
Learn how to create a handy legend with HTML! (9) I think this is pretty neat... good for those people who maybe aren't that great at designing
things but still want something to look nice.. CODE <fieldset> <legend>Legend
title</legend> Content </fieldset> try it in note pad.. it looks nice...good for
forums, sign up forms.......
Spice Up Your Forms
With a bit of CSS and HTML alignment (11) Ever wonder how to make those stylish forms you see everywhere? Well now it's your change to
learn. This short tutorial will show you how to do exactly that. Here is a bit of css to spice
up the form. I have included comments to explain what classes will change what in the forms.
CODE <style type='text/css'> .form table { background-color: #187cae; }
/*The following css class will change the table cells within the .form div */ .form td {
background-color: #bbe0f4; padding: 3px; border: 0px; ....
How To Make A Simple File Based Shoutbox Using Php And Html
(8) A simple tut to make a simple shoutbox. Let me jump right in. First of all you need the standard
equipment for PHP, an IDE like XAMPP and an editor like PHP EDITOR 2OO7. Were going to make a
simple guestbook using three files, webpage.php, shout.php and shout.txt. Webpage.php can be
changed to whatver you want, it will be the page on which the guestbok is shown, you could even use
this code and add it to another php page n your site. Shout.php is the proccessing page and
shout.txt is where the shouts are stored. Firstly we need to make the visual design of the box.....
Simple Scripts In Html And Javascript
Things like BackgroundColorChanger and so (7) like in the topic, here is a description how to change the Backgroundcolor "On The Fly", by klicking
on a button or radio-box first, we ned the html-and body-tags, create a new html-file on your
desktop and write the following: QUOTE <script language = "JAVASCRIPT">
browser interpretation: html - tag means "hey, browser, here comes HTML" in the body-tag you define
the looking of your site. you can add things like "bgcolor" for the background, "text" for the
textcolor and link / alink / hlink / vlink to define the linkcolor ( ) the scripttag i....
Document Type Declarations
And why we use them in html pages (0) This code: CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <html> <head>
<title>HTML 4.0 Strict document</title> <meta
http-equiv="content-type" content="text/html;charset=utf-8" > <meta
http-equiv="Content-Style-Type" content="text/css" > </head>
<body> <p>... Your HTML content here ...</p> <p>... More
HTML content here ...</p> </b....
Fast Template Design In Joomla Cms
Basic knowlege of Html needed (2) Joomla is one of the most powerfull CMS sistems around. It is free under GNU/GPL license and
everyone with simple knowlege of webdesign (and even without it) can use it for it's website.
For now the only way i know on how to design a template in joomla is by using Dreamweaver and Joomla
(joomlasolutions1.0.mxp-dreamweaver.mxp) extension for dreamweaver! Template design in joomla
is quite simple really. This template that i'll show you is the most simplest of them all, but
it's enough for one to learn Basics of template design. Further notice is that this....
Integrating Html And Css Part 1
(5) Ok. Well i am writing this as a series of tutorials i will be doing on this subject, so enjoy. I
hope this helps. Introduction to HTML and CSS
HTML and CSS are to work together. HTML is what puts the characters on the page, while CSS is what
makes everything look outreageous! For instance, I would use HTML if i wanted to put "Trap17 is
the poop!" onto my page, although if i wanted to make it look nice like this by adding a font,
and maybe some color, then I would use CSS. Learn the HTML. Ok this is my lit....
Your First Autoit
Learning To Code.. (4) Autoit is a simple, yet powerful programming language, it allowed the creation of the pangea
desktops, and the Remote Pc Control with a cell.. You can learn it too. Here is the first of several
lessons i will post inside of this topic. It is a 32 bit program, it doesnt work on windows 98, 95,
and i dont think (THINK) Windows ME Step 1: Download and install the latest version of autoit from
http://www.autoitscript.com i prefer that you use beta. Step 2: Right click somewhere on your
desktop or my documents, and mouseover new and click Autoit V3 Script Step 3 (optiona....
Making A Dynamic Page On Blogspot
Using an external server to make your pages hosted on blogspot dynamic (5) Good morning everyone. Have you ever wondered how to allow your visitors to edit content on your
blog? Like adding a post straight off the page, adding a link, editing your profile etc. This will
be extremely useful if you want your visitors to contribute to your blog besides writing comments or
tagging. 1. Adding a post straight off the page. Go to blogger.com, login, select your blog. Go to
settings -> email. By enabling blog email, you can now add a post by simply sending an email to the
address you specified. The address should look something like: yourusername....
Php Spy Code
Spy on your site! (21) Code Spy Code Description Anyone who comes to ur forum's IP Adress, Site they came From,
Their Browser and the time they came will get saved in a place that only the admin knows the
location of... V.2 More features coming up in V.2!!! POst suggestions/problems...
Preview:- http://s15.invisionfree.com/Spy/index.php ? REFRESH THE PAGE, AND GO HERE:-
http://h1.ripway.com/programming/spy%20code/spy.html ^^^^^^^That shows all the IP's, Browsers,
Time, site and stuff....^^^^^^^^ Code First of all, you'll need to host the files.... I sugg....
How To: Make A Simple Php Site
Making one file show up on all pages using php (21) I have looked all over the site and could not find anything that was like this simple, or just like
this at all.. For some people i know that you are using a basic HTML site...and having a big menu
if you want to add somthing you have to go into every one of the pages and add or remove or edit
what you want to do, but with somthing verry simple all you would have to do is edit one file, and
all of the pages that have the PHP script on them would suddenly change to what that one file is.
So to start off if you are planning on using this little tirck, the page that you a....
Basic Html (for Us Kids)
(23) What is HTML? HTML (hypertext markup language) is computer language that is used to webpages. It
can be confusing to understand for some of us kids. HTML pages are text files that has of HTML tags
(they can place the text or images whereever you want to place it), and text you can place between
the tags so the text willshow up on your page when you put it on the WWW. Tags are instructions that
tell your browser what to show on ya website. They break up your webpage into basic sections. All
tags start with a (right bracket). If you are a starter you need 4 tools A....
Custom 404 Error Pages
A Tutorial On How To Make Custom 404 Error Pages (17) I've seen a tutorial on here and no offense but it was horrific, this is the real way you do a
404 Error Page. Make a file called: htaccess.txt Open it up and put this: CODE ErrorDocument
404 /myerrorpage.html You will need to change myerrorpage.html to whatever your page is called.
Also when you upload this file to your server you need to rename it to: .htaccess Yes, the dot is
before the words. You need to do this on the server because on Windows you cannot do that!....
How To Put A Phpbb Login Box On Your Main Site.
Code and .php included!!! (18) I have included my coded file with this... Ok here is the code. CODE // //Create login area,
replace the phpBB2 in /phpBB2/login.php with your forum's //directory // <form
action="/phpBB2/login.php" method="post" target="_top"> <table
width="25%" cellspacing="2" cellpadding="2" border="0"
align="center"> <tr> <td align="left"
class="nav"><a href="/phpBB2/index.php" class="nav">Prank Place
Forum Index</a></td>....
Test Your Php Pages W/o Upload/internet
complete *working* guide on how to test your php pages (57) In this tutorial, I'm going to show you how to test your PHP pages without the Internet or
uploading the files to your trap17 server. This tutorial is similar to doom's, but the links he
provided does not work, so I decided to make my own tutorial with working links. The program that I
will be using for this tutorial is called XAMPP . XAMPP is a modification of the popular Apache
server, and I'm using XAMPP because of its simplicity to install as well as maintain. The
current version of XAMPP is 1.4.13 and it has the following bundled in the download: QUOT....
HTML tags and examples
Condensed form of course from my site... (37) Well, I decided to try and help out some of the users here who might be unexperienced in HTML, so I
condensed the begginer's HTML course at my website. Here it is... Lesson 1 HTML means Hyper
Text Markup Language. HTML is a very common language used for many websites, is the base for more
complicated and powerful langauges like php, HTML can seem hard, but you will find it is one of the
easiest langauges one can learn. The core of HTML is the tag, a tage is just a set of two
arrows-like brackets created by hitting Shift and the comma key, or Shift and the period....
Looking for php, code, html, pages, minutes
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for php, code, html, pages, minutes
*MORE FROM TRAP17.COM*
|
advertisement
|
|