Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help with site.
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Lazarus




PostPosted: Sat May 21, 2005 9:19 pm   Post subject: help with site.

Hey, I need some help with this site, obviously it has to be moved from freewebs to something that will allow PHP and mysql, I really don't know PHP and would like to learn, but not at the moment. Also any good free forums out there?

Right.. What I need help with is that I've made the same layout a good 10 times and I'm getting sick of it, all i want to do is change the text on some pages, which isn't a problem, but say I need to add a link, I need to go to everyone of my pages and change it, it get's annoying. Anyway that PHP can change this? where you only have to change it on the layout, and it will change it all?
Sponsor
Sponsor
Sponsor
sponsor
JackTruong




PostPosted: Sun May 22, 2005 8:43 pm   Post subject: (No subject)

Read up on the include(); function for PHP. Pretty much, what include() does is that is inserts text from the file (parameter passed in include()Wink and... that's it.

An example would be:
code:
<html>
<head>
<title>My Test</title>
<body>

That would be code to have the title the same.

code:
<?php include("file.above"); ?>
Body text
</body>
</html>
That would insert the code above where you have include() and run as normal.

I have bad explanation skills...

---------
Free forums? As in the forum software? phpBB is probably the best free forum out there. I'd stick to my free IPB versions though.
Blade




PostPosted: Mon May 23, 2005 12:46 am   Post subject: (No subject)

to elaborate and make it a little more dynamic...

he is right, use include(); ... but what hes trying to say is what it does is include another file into your php page. you dont really need mysql for something like this. also, since you're using your layout as your main page, you're already using html and body tags, so they're a little redundant.

like he said
HTML:

<font color="blue">this is your page</font>


php:

<!-- your layout/template page -->
<html>
<head>
<title>Title</title>
</head>
<body>
blah blah
blah
<? include($_GET['page'] . ".html"); ?>
blah
</body>
</html>


basically what $_GET['page'] does is it gets the variable, $page, from the address bar. so to 'include' a page called news.html into your body you'd use the url

http://linktoyoursite.com/index.php?page=news

assuming you're template/layout page is called index.php
to shorten the url, you can also use

http://linktoyoursite.com/?page=news

i hope this helped and you understood everything, any questions feel free to ask.
Lazarus




PostPosted: Mon May 23, 2005 6:22 pm   Post subject: (No subject)

okay thanks alot I'll add it in there some time this week.
wtd




PostPosted: Mon May 23, 2005 11:55 pm   Post subject: (No subject)

Don't use font tags.

You make God cry everytime you use font tags rather than stylesheets. Wink
Blade




PostPosted: Tue May 24, 2005 12:05 am   Post subject: (No subject)

haha yeah i dont personally use them. i was only proving how you're still able to use tags but you dont have to be redundant with <html> and <body>
wtd




PostPosted: Tue May 24, 2005 11:34 pm   Post subject: (No subject)

There's a problem with your code, though:

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


You do no sanity checking to make sure that the page is one that should be displayed. As it stands, this could be used to display any HTML page on the server.
JSBN




PostPosted: Sun May 29, 2005 2:19 pm   Post subject: (No subject)

among other things, use css for your styles. it's ALOT easier to keep control of everything, it's what i use with all my sites. If you are looking for info on css, check out the w3 site

basically, with css, you have one file that has ALL of the styles you want, and withing your web page you can call individual styles. just import the css file at the top of each .html or .php file and you are set to go!
THis is in the css file
code:
.loginpagetabe{
        background-color: #333333;
        color : #FFFFFF;
        font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;
       }


This is in the web file:
code:
<link rel="stylesheet" type="text/css" href="includes/style.css"); />


and this is how you call it
code:
<TD valign='top' CLASS='loginpagetable'>


PHP is an AWSOME tool for web design. I suggest learning it if you wish to make your pages dynamic and easy to use. If you wanna learn php fast, try making your own mods for phpBB; you will learn how to read the code and how to write it.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: