PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
pedro84
Forum Newbie
Posts: 11 Joined: Sat Oct 21, 2006 11:28 am
Post
by pedro84 » Sat Oct 21, 2006 11:32 am
Hello!
I wanna to ask You guys if I'm writing my site in good way
index.php:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Michael-Schenker.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<?php
include('includes/header.php');
?>
<?php
include('includes/menu.php');
?>
<?php
include('includes/content.php');
?>
<?php
include './include.php';
?>
<?php
include('includes/footer.php');
?>
ew. included file:
Code: Select all
<?php
echo "<div id=\"footer\"><p id=\"copy\">Copyright 2006 Michael-Schenker.com</p></div>\n";
echo "</div>\n";
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
?>
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sat Oct 21, 2006 12:45 pm
It's fine, but could be better...
Use a template engine like Smarty or Savant...they do what your doing but better.
pedro84
Forum Newbie
Posts: 11 Joined: Sat Oct 21, 2006 11:28 am
Post
by pedro84 » Sat Oct 21, 2006 12:47 pm
Hockey: Thank You, I'll do what You say. Thank You once again. But I don't understand one thing? Smarty is for webistes with more that one layout?
No Capisco:)
RecoilUK
Forum Commoner
Posts: 30 Joined: Sun Feb 29, 2004 7:13 pm
Post
by RecoilUK » Sat Oct 21, 2006 3:23 pm
Hi
In my opinion, you should have a template folder, in which you put mainly HTML but still use a .php extension.
Then your main pages, menu.php would have the program logic in them, they then intrun call the necessary include files.
Template engines are a waist of time, when PHP is a very good templating engine already.
Just my opinion, others will disagree.
Thanks
pedro84
Forum Newbie
Posts: 11 Joined: Sat Oct 21, 2006 11:28 am
Post
by pedro84 » Sat Oct 21, 2006 3:25 pm
I think I'm too n00bie to php, to make it:(
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sat Oct 21, 2006 6:02 pm
pedro84 wrote: I think I'm too n00bie to php, to make it:(
Never
You're already halfway to templating. If you can separate out anything that's not directly related to what's displayed on-screen then you're basically templating.
pedro84
Forum Newbie
Posts: 11 Joined: Sat Oct 21, 2006 11:28 am
Post
by pedro84 » Sat Oct 21, 2006 6:06 pm
I'm using Smarty. But now, I can't add any site. Only mainpage
It's getting veeeery funny:)
I'm frustrated:)