Jump to content

PHP to HTML?


Baggy

Recommended Posts

I have downloaded a site into Dreamweaver (belongs to my son) to try to do a little updating/editing.

 

I have managed to get it working now but discover it's written in php. I know little enough but certainly know nothing of php. It look really different when I open pages in DW, as none of the layout shows, only the text.

 

Is it possible to convert a site written in php into html (which is all I've experienced)?

 

Sorry if this is a daft question.

Link to comment
Share on other sites

If you want to process the PHP on your computer, download WampServer 2 which has PHP and Apache server to process it locally.

http://www.wampserver.com/en/download.php

 

Alternatively, if the page is online, open it in your browser where all the PHP will have already been processed by the host server, View Source and then save as a .html page instead of .php.

 

You should then be able to use it as a normal html page because all the php code will have been processed to normal html by the hosting service server.

 

Edit: having converted it to a html page, make sure any links to it are changed to .html and you will have lost the benefit of any PHP, like processing to a database. It really depends what the PHP is doing on the page.

 

If only the text shows, not the layout, it sounds as if you haven't downloaded the css stylesheet (a .css file) which is a slightly different problem from the php.

Edited by Wickham
Link to comment
Share on other sites

Thanks for the reply.

 

There is a .css folder and one file in there is called site.css (here's a sample of what it shows)

 

Body { margin:0; font-family: Arial, Helvetica, sans-serif; overflow-x: hidden;

background: url('../images/bkg.gif') repeat-y fixed center #D48E14; }

div.container { overflow: hidden; }

a:link,

a:visited,

a:active { color: #CC0000; }

a:hover { color: #000000; }

p { clear: both; }

div#footer { clear:both; border-top: 1px solid #333; width: 920px; margin: 10px auto 0 auto; text-align: center; padding: 5px 0 0 0; }

 

div#map { margin-bottom: 20px; }

 

img.borderme { border: 2px solid #D48E14; }

 

div.container { background: url('../images/indexbkg2.jpg') no-repeat bottom left; }

body#index div.container,

body.hpbkg div.container { background: url('../images/indexbkg.jpg') no-repeat bottom left; }

body#index h2#subtitle { width: 500px; }

body#index p.content { width: 300px; margin: 10px auto 15px auto; }

 

So I guess I have downloaded everything?

 

I have to say, the file structure/content is so different to my 'old site' (html), I'm struggling to make head or tail of it!

Link to comment
Share on other sites

One other problem - when I try to preview any page in either IE7 or Firefox it says "To preview pages containing server-side code, you need a testing server. Would you like to specify one now?"

 

I don't have this message when I preview pages on my old site. Can anyone explain that for me please?

Link to comment
Share on other sites

There is a .css folder and one file in there is called site.css

 

In which case create a folder on your computer called css in the folder where the php file is, or in the folder at the level above (are you sure the folder is .css with a . as this seems unlikely) and put site.css file inside. With any luck all the paths will still be correct for the link to work. Can you post a link to the php page that you are trying to convert to html?

 

 

As far as the conversion from PHP to html is concerned, I said previously that it depends what the PHP is doing. If it is just inserting code like headers, menu or footer from a separate "include" file, then when you download the page from the online version, view source and save it as a .html page, all the code you need is already there as it's been processed by the host's server.

 

However, you haven't said what the page php does, if it uses more complicated php coding to process to a database or perform other functions by communicating with a server from the actions of the viewer (say by entering information or clicking) then that won't work after converting to html.

Edited by Wickham
Link to comment
Share on other sites

Judging by the links on that page, you will need a very complex html-only site, mod-rewrite to manage the urls, or you have a modular design that uses a single php index page to sort through the pages available. The last two require a Server installed Locally.

The thing that suggests the above are the on-hover urls become SEO-friendly, with no file extensions.

Link to comment
Share on other sites

To be Honest, if you want a good interactive website, you really have to use PHP now, HTML is only a way to convey the text and images and the formatting to the Browser. PHP allows so much more control now, I hated to do it, it was like talking a foreign language, but i am happy i have started learning to use it.

Link to comment
Share on other sites

  • 1 month later...

Click the icon on your desktop and you should see a small semi-circular icon appear in the system tray.

 

Left-click the icon and click the top item which either says Localhost or 127.0.0.1 and it should open the browser that you chose as the default.

 

In the browser window you should see the WampServer server configuration.

 

Left-click the system tray icon again and the fourth item down says www.directory. You can move php files into this directory but you can only load php files for testing by typing in the filename (and a sub-folder name if applicable) into the open browser window after http://localhost. It's no good finding the www directory via My Computer or Windows Explorer and double clicking files there to open them, they won't open.

 

You can also access the www directory via the browser server configuration screen which you first opened up where it says "Your Projects" and clicking on a filename.

Link to comment
Share on other sites

I have tried to follow your guidance (for which, thanks) but I'm struggling. At the top of Server Configuration, it says "Intranet settings are now turned off by default. Intranet settings are less secure than Internet settings. Click here for options" - what should I do here please?

 

If I left click on the www.directory it opens a folder called www which has index.php in it. If I double click that, it opens Dreamweaver and the text is weird and means nothing at all to me.

Link to comment
Share on other sites

When I try to open anything in 'localhost', I get:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

Link to comment
Share on other sites

Have been continuing to 'stagger around in the dark' and managed to get one file (index1.php) to open in local host but got this error at the top of the page:

Warning: include(system/system.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\index1.php on line 3

 

I found the system.php file in the 'system' folder and moved that into wamp/www folder but it still returns the same error at the top.

 

Getting nowhere fast.

Link to comment
Share on other sites

meant to add that the second line at the top of the page in localhost says:

 

Warning: include() [function.include]: Failed opening 'system/system.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\index1.php on line 3

 

I would really appreciate some more guidance please.

Link to comment
Share on other sites

You shouldn't need to take the files out of the folders -- that could be what is causing the errors in the first place. As Stefan said, the error is telling you that the PHP processor can't find a file it is looking for.

 

Where are all the files stored at the moment? No matter what the folder structure is, all of the files need to be stored in the "www" folder where the server can access them. If any files are stored outside the "www" folder, the server won't be able to access them, and you may run into errors.

Link to comment
Share on other sites

Stay with it Baggy! I just began to use the WAMP server and I also beat my brains out and lost a lot of hair!

 

What Stef and Falken said: The paths must be correct!

 

If you can download all the original files, all in their original folders into the www and keep that structure, things should work!

 

Keep the faith!

 

Alfie

Link to comment
Share on other sites

thanks for the latest replies (and encouragement)

 

All the download of the site are in a folder on the desktop. I have just highlighted/copied all the folders. Then I went into C:\wamp\www (in explorer) and pasted the lot in there.

 

6 Folders now show in 'Your Projects' in localhost. I am totally unsure how I now open any file to see the design/code to be able to make changes?

Link to comment
Share on other sites

Hmm. In that case, create a new folder in the "www" folder, and name it the name of your project. Then move all of the files you just copied into the "www" folder into that new folder. That should simplify things into one project in localhost, rather than multiple.

 

To view the pages: Open localhost and select your project. If a web page doesn't come up immediately, you may need to select one to open -- it'll probably be named "index.php" or "home.php" or something similar.

 

To edit the pages: You can either right click on the files and choose a program to open them/edit them with, or you can set up a new project in Dreamweaver with the project folder (within the "www" folder) as the root folder.

 

Make sense?

Link to comment
Share on other sites

I think I've messed things up now. I went into windows explorer and deleted the contents of www. I then created a new folder in www and copied the contents of the site download from the desktop folder.

 

Now local host doesn't show the winamp server configuration, I just get this screen:

 

Index of /

Name Last modified Size Description

 

--------------------------------------------------------------------------------

 

Accel/ 22-Jul-2009 07:51 -

 

--------------------------------------------------------------------------------

 

If I click on it, it opens the folder structure, which has its own www folder. When I click on that it opens the homepage of the site in IE7. It doesn't expand the www folder to show everything within it, so I can't see individual files/folders. Right-clicking on the projects www folder doesn't allow me to expand it either.

 

Is the problem with the name of that folder (www)?

Link to comment
Share on other sites

The www folder had an phpinfo.php file put there by WinampServer so it looks as if you have deleted that now which shows Server Configuration and Your Projects.

 

You've changed so much that it may be better to install winampServer 2 again and then follow my suggestions in post 12.

 

All files you wish to test must be in the www folder or a sub-folder in www and you must open winampserver, then localhost which opens your default browser with localhost already seen in the browser address bar, and it should open the phpinfo.php file that Winapserver put there, then go to Your Projects and select a file or type in your filename after localhost in the browser address bar window.

 

Additionally, when you left click the system tray icon, if the bottom link says "Put Online" then click it online. Whenever I open winampserver it says "Put Offline" which means it's always online for me so I never have to do anything except click localhost.

 

Try again, hope you succeed next time.

Edited by Wickham
Link to comment
Share on other sites

I have re-installed winamp and put the whole downloaded site folder in www. Localhost server configuration now opens and the site folder is shown in Your Projects.

 

When I click on the named project I get this:

 

Index of /Accel

Name Last modified Size Description

 

--------------------------------------------------------------------------------

 

Parent Directory -

Interchange Photos/ 22-Jul-2009 09:37 -

cgi-bin/ 22-Jul-2009 09:37 -

etc/ 22-Jul-2009 09:37 -

logs/ 22-Jul-2009 09:37 -

t 19-May-2009 20:20 0

www/ 16-Oct-2008 00:00 -

 

The files/folders I need to access are in the www/ folder and when I click on that, the Home Page of the site open in Internet Explorer, not in localhost, is this right?

 

If so, I cannot work out how to get to the individual files to work on them. As I mentioned previously, I have changed the path of the root directory in Dreamweaver, to point it to winamp www but winamp doesn't show in the list of testing servers.

 

Furthermore, opening the files in Dreamweaver, now they are in winamp, still doesn't reveal the page coding that I need to see.

Link to comment
Share on other sites

Sounds like it is working correctly, actually. You don't use localhost to see all of the files/folders in the website -- you use Windows Explorer for that. Localhost is used for previewing the website, as it would be if it were live on the web.

 

Windows Explorer - viewing all files/folders

localhost - previewing website

dreamweaver - editing the website files

Link to comment
Share on other sites

OK! Here's a probable problem. I believe you are not using the right www folder.

 

  • Click on "My Computer" on your desk-top.
    Choose the "local disk" icon and click it
    You should have a folder therein named WAMP. Click on that to open it.
    There should be a folder in there called www. That's where your files should go!

 

NOW! Don't bother clicking directly on your downloaded files. All you will get is the raw text documents because the php engine within WAMP is not yet functioning.

 

Close everything back up and start your WampServer (Which I believe you now know how to do.) And from within IT you should be able to run the site with all the php functions running properly.

 

To edit the files, you have to get back to that same www folder as you did above, do your changes and save them. (Make a copy of the original file first!!!) Save your changes under the exact same name. (You will have the copy you made to "undo" anything you screwed up! :D)

 

Now view your changes from within the WampServer as before.

 

Hope it helps!

 

Alfie

Edited by daddyalfie
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...