Jump to content

Help With Php Plz


ShadowPaktu

Recommended Posts

I'm getting into php alot now, particually with my forums, i experiemtn alot, but ive never needed to include files.

 

This dawned on me as it would be so much easier to update my site (not the forums) but changing one file, it would take effect on all pages that it has included.

 

Am i correct in that just after the <body> tag in the page where i want to load up a php file i put in

 

<?

include('filename.php');

?>

 

and then where i want a variable (provided i have a varibale defined in my php file) i just place $variablename where i want it to go?

 

What if the variable is a color (which is what im first testing it on)

 

<body text="#ffffff"> my text, ya i know there's not much formatting and htis will be in white </body>

 

would that become:

 

<body text="$variablename"> my text, ya i know there's not much formatting and htis will be in white </body>

 

and the php file would be something like:

 

<?

$variablename ="#ffffff";

?>

 

i know there's somethign wrong with this cos it dont work! :P

 

so any help to get me off to a start would be greatly appreciated.!!!

Share this post


Link to post
Share on other sites

I'm getting into php alot now, particually with my forums, i experiemtn alot, but ive never needed to include files.

 

This dawned on me as it would be so much easier to update my site (not the forums) but changing one file, it would take effect on all pages that it has included.

 

Am i correct in that just after the

tag in the page where i want to load up a php file i put in

 

include('filename.php');

?>

 

and then where i want a variable (provided i have a varibale defined in my php file) i just place $variablename where i want it to go?

 

What if the variable is a color (which is what im first testing it on)

 

my text, ya i know there's not much formatting and htis will be in white

 

would that become:

 

my text, ya i know there's not much formatting and htis will be in white

 

and the php file would be something like:

 

$variablename ="#ffffff";

?>

 

i know there's somethign wrong with this cos it dont work! :P

 

so any help to get me off to a start would be greatly appreciated.!!!

Your body tag must read something like:

 

 

When you are just using:

 

 

You are not parsing $variablename through PHP.

Share this post


Link to post
Share on other sites

Ah, i sorted it know, i created a test page to get it working and currently my main page which calls 2 others, looks like this:

 

<?php

$pagetitle = "Shadow is testin PHP!!!";

 

require ("header.php");

 

require ("game1.php");

 

require ("game2.php");

 

require ("footer.php");

?>

 

one of my other called php's looks like this, the header.php:

 

<html>

<head>

<title>

<?php

print ("PageTitle");

?>

</title>

</head>

 

<body bgcolor="#f1f1f1">

 

the end body tag is finnished in the footer php file.

 

What i want to know is how to assign values still

 

like

 

text color=$textcolor

 

where $textcolor = "#ffffff" in a php file called 'colors.php'

 

so if i want to update the text color of all my pages, instead of going through each one and changeing them, i would just open up the colors.php and change it there. As all my HTML pages use the 'text color' as what ever is in the 'colors.php' they would all call it.

Share this post


Link to post
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.

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.

×
×
  • Create New...