Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 14
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
One birthday today, congrats!
Vaxian (17)


Next birthdays
05/21 Dalus (34)
05/21 Kizmo (37)
05/22 Skynet (32)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

PHP website design

1 2 3 
Move Thread LAN_403
uzzors2k
Fri Oct 12 2007, 07:49PM Print
uzzors2k Registered Member #95 Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
I'm preparing to migrate from googlepages and rebuild my website with a proper layout. I want to try php since I like the layout many php pages have. Such as the forum here, and c4r0's page for example. Basically a frame that is always present, with changing content inside. Is php the easiest/best way to go for such a layout?

Can you recommend any good editors for php? There seem to be thousands out there so I just wanted to see if anyone had a preference first. As long as it has a some kind of preview function and is freeware I'm satisfied.
Back to top
Bjørn
Fri Oct 12 2007, 08:37PM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
PHP is just a programming language so alone it does not solve any problems. It just makes it possible to dynamically generate HTML pages. You still need to write the program that generates the HTML code. You can also download some free code and modify it to suite your needs.

Any text editor is good enough for PHP, one with syntax highlighting is better, if you want to spend hours and hours every day doing PHP you probably want an editor that can execute and debug PHP programs in place.
Back to top
Amateur-Scientist
Fri Oct 12 2007, 11:04PM
Amateur-Scientist Registered Member #1015 Joined: Fri Sept 21 2007, 06:43PM
Location:
Posts: 14
There are many languages/scripts to do websites like PHP and ASP. I like PHP and MySQL for dynamic content. Since many hosts have PHP installed, it is just a matter of using a CMS tool. Most hosts have the a CMS, forums, galleries, Mysql pre-installed for you. You can also write your own website in PHP or use a template system like Smarty. For an editor, Dreamweaver will edit PHP directly and link to your style sheets to make it wysiwyg. I also use DZsoft PHP editor.
Back to top
Simon
Sat Oct 13 2007, 02:56AM
Simon Registered Member #32 Joined: Sat Feb 04 2006, 08:58AM
Location: Australia
Posts: 549
PHP is neat. It works inline with HTML, so the source of a PHP page looks like a regular HTML source with PHP commands slotted in. These PHP commands get parsed and executed by the server, generating a pure HTML page. The end result is completely transparent to the client. The "source" of a PHP page from a browser end looks just like the source of any other page.

How would PHP help you? For the sidebar example, you could have the sidebar HTML code in a file. All of your PHP pages would have a command slotted in that dumps the sidebar code from the file. That means every page would have the same sidebar, and to edit the sidebar you'd just have to edit the one file.
Back to top
ragnar
Sat Oct 13 2007, 03:26AM
ragnar Registered Member #63 Joined: Thu Feb 09 2006, 06:18AM
Location:
Posts: 1425
A great text editor to use with syntax highlighting and FTP publishing is Crimson Editor:
www.crimsoneditor.com

Try both download links, because one of them doesn't work.

For what you need to do, you won't need to learn much PHP. The include function should get you started. Make your index.php page with all the content you want, and put the menu that you'd like repeated in a separate file; e.g. sidebar.php

At the top of index.php, you can then write something like:
<?php include("http://www.yoursite.com/sidebar.php");? >
(this will just include page content, won't execute PHP or pass variables)

or even better:
<?php include("/home/youruser/public_html/sidebar.php"); ?>
Back to top
c4r0
Sat Oct 13 2007, 10:59AM
c4r0 Registered Member #151 Joined: Sun Feb 12 2006, 02:53PM
Location: Poland
Posts: 153
Hi! First of all i'm glad that you like my website layout smile I use Notepad++ ( Link2 ) to write the code. PHP is very useful and also easy if you have some experience with programming in C. All PHP code is executed on the server side and web browser gets only a HTML code generated by the PHP script. So despite using PHP you also need to write all your websites content in HTML. The SIMPLEST way to make such "frame" is to write an index.php file consisting all the static content (site logo, menu etc.) coded in HTML and different .php files for each article also coded in HTML. Then paste this php code

<?php
include($_GET["page"].".php");
?>

in index.php file, in place where the article should be displayed. Then when you type "www.../index.php?page=article" in the browser it will load the index.php layout with article.php inside. But this is only a simple example, it should be made more resistant to hacking (in this exapmle hacker can run his php script on your server by typing "http://yourdomain.com/index.php?page=http:// hackersdomain.com/thescript.php"). Hmm, i cant explain it better so you should read some tutorials or sth or wait for other replies tongue PHP is realy powerful and cool, you will like it :)
Back to top
Steve Conner
Sat Oct 13 2007, 12:49PM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
I used a similar method to do this site: Link2

But it would probably be better to find yourself a ready-made free open-source CMS (Content Management System) written by someone else. A full-blown CMS is a serious programming project, and it's not like nobody's done it before. I'm playing around with Wordpress just now, though it's more a blogging engine than a fully configurable CMS.

For previewing, I have a Linux server at home with PHP, Apache, MySQL and Samba installed anyway. My home directory on the Linux box appears as a Samba network drive. So I just edit source files with a text editor on my Windows machine and refresh my web browser to see the changes.
Back to top
uzzors2k
Sun Oct 14 2007, 09:10PM
uzzors2k Registered Member #95 Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
Thanks for the responses. I'll convert my content into html and try the include function then.
Back to top
uzzors2k
Sun Oct 21 2007, 09:24AM
uzzors2k Registered Member #95 Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
The code works well, but I don't like the ease of hacking. I found some code which is supposed to limit the included files to pages within the current directory, but I can't get it to work.

<?php
$page = $_GET["page"];
if ( !empty($page) && file_exists("/" . $page . ".php") && ( stristr( $page, "./" ) == False ) )
{
$file = $page . ".php";
}
else
{
$file = "SiteNews.php";
}

include $file; ?>


The problem is in the if function. The empty check works, but the other two don't. Basically I want it to limit itself to only including files within the same directory as index.php and having a .php extension. That should stop external files from being executable. Can anyone see what's wrong with the code?
Back to top
Steve Conner
Sun Oct 21 2007, 12:17PM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
Yes, the paths in PHP are often absolute. They are on my server at least.

This means that your apage.php might actually be /home/uzzors/public_html/apage.php, but that if statement is looking for it in /apage.php.

There might be some system variable that gives the directory the current script is in. You could add this into the statement. Or I could be totally wrong, it's a while since I've messed with this stuff.



Back to top
1 2 3 

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.