PDA

View Full Version : .php headers?



Black_Apalachi
18-07-2009, 05:22 PM
I don't even know if that title makes sense, but I've decided to use a free coded layout to have a go at editing it and stuff.

Anyway, this is the layout in question: http://www.habbville.com/site/files/content/free_layouts/layouts/L22/index.php

As you can see, there's three boxes to the left each with a header. However the coding for the header is as follows, (this is the first box):



#nav_top {
height: 22px;
background-image: url(header.php?t=Navigation);
}That's all fine and I love the idea of doing it that way, but when I open index.php to view in my browser, those headers don't display at all.

I was wondering if anyone knew why this may be the case? (I also removed the script that makes the boxes slide up and down but the problem occured both before and after I did so).

As a seperate question, if the folder has a main.php file with the home page's content, how do I make this actually display on the homepage? Or should I just continue adding the home page's content straight to index.php as I have been?

Thanks in advance :).

BoyBetterKnow
18-07-2009, 05:30 PM
I don't even know if that title makes sense, but I've decided to use a free coded layout to have a go at editing it and stuff.

Anyway, this is the layout in question: http://www.habbville.com/site/files/content/free_layouts/layouts/L22/index.php

As you can see, there's three boxes to the left each with a header. However the coding for the header is as follows, (this is the first box):



#nav_top {
height: 22px;
background-image: url(header.php?t=Navigation);
}That's all fine and I love the idea of doing it that way, but when I open index.php to view in my browser, those headers don't display at all.

I was wondering if anyone knew why this may be the case? (I also removed the script that makes the boxes slide up and down but the problem occured both before and after I did so).

As a seperate question, if the folder has a main.php file with the home page's content, how do I make this actually display on the homepage? Or should I just continue adding the home page's content straight to index.php as I have been?

Thanks in advance :).

You got the header.php on ur server? In same directory.

And to display homepage, <?php include 'pagetodisplay.php'; ?> inside the content area.

RastaLulz
18-07-2009, 05:40 PM
Do you have PHP GD downloaded on your web server (or computer)?

Black_Apalachi
18-07-2009, 05:46 PM
You got the header.php on ur server? In same directory.

Yep. And this is what's in it if that helps:



<?php
header("Content-type: image/png");
$text = $_GET['t'];
$im = imagecreatefrompng("images/top.png");
$font = "volterb.ttf";
$white = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 7, 0, 9, 14, $white, $font, $text);
imagepng($im);
imagedestroy($im);
?>
And to display homepage, <?php include 'pagetodisplay.php'; ?> inside the content area.I don't think I'm doing it right... I've put <?php include 'main.php'; ?> (with and without the question marks lol) between <!-- Start Main Content --> and <!-- End Content -->



Do you have PHP GD downloaded on your web server (or computer)?

don't think so.. what's that?

BoyBetterKnow
18-07-2009, 06:01 PM
Yep. And this is what's in it if that helps:



<?php
header("Content-type: image/png");
$text = $_GET['t'];
$im = imagecreatefrompng("images/top.png");
$font = "volterb.ttf";
$white = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 7, 0, 9, 14, $white, $font, $text);
imagepng($im);
imagedestroy($im);
?>I don't think I'm doing it right... I've put <?php include 'main.php'; ?> (with and without the question marks lol) between <!-- Start Main Content --> and <!-- End Content -->




don't think so.. what's that?

GD is what is needed to generate the images.

and have u put the <?php include 'main.php'; ?> inside the <div id="content"> or w/e it is ??

Also does images/top.png exist?

Black_Apalachi
18-07-2009, 06:11 PM
GD is what is needed to generate the images.

and have u put the <?php include 'main.php'; ?> inside the <div id="content"> or w/e it is ??

Also does images/top.png exist?

The other images work, so I must have that then. It is in the content div and the image does exist :P.

Does the main.php file have to have anything in particular in it to work?


Edit: on the topic of the content, the same thing happens with the navigation. The original layout has working navigation links but when I open the index.php in my browser they just bring a blank page an I haven't even touched them...

BoyBetterKnow
18-07-2009, 06:36 PM
The other images work, so I must have that then. It is in the content div and the image does exist :P.

Does the main.php file have to have anything in particular in it to work?


Edit: on the topic of the content, the same thing happens with the navigation. The original layout has working navigation links but when I open the index.php in my browser they just bring a blank page an I haven't even touched them...

I don't know what this specific script does. Perhaps the main incldue has got to have the $_GET page name.

Black_Apalachi
18-07-2009, 07:19 PM
I don't know what this specific script does. Perhaps the main incldue has got to have the $_GET page name.

so where would you add '$_GET'?

BoyBetterKnow
18-07-2009, 07:46 PM
Well I don't know how your script works.

But say main.php or w/e was ur page processor you would do something like (on the index.php page u got).

Well u would need to do $_GET['page']; before your include then it'd get it I suppose.

Black_Apalachi
18-07-2009, 09:14 PM
Well I don't know how your script works.

But say main.php or w/e was ur page processor you would do something like (on the index.php page u got).

Well u would need to do $_GET['page']; before your include then it'd get it I suppose.

how exactly would you add it though?

for example I've tried:

$_GET'main.php'<?php include 'main.php'; ?>

<$_GET'main.php' ?php include 'main.php'; ?>

<$_GET'main.php'><?php include 'main.php'; ?>

<$_GET'main.php'; ?php include 'main.php'; ?>

I know I'm a noob lol :P

besides, it works fine in the one --ss-- has done, and all I've done is open the index.php in Firefox, so I don't see what can cause it... :S

BoyBetterKnow
18-07-2009, 09:15 PM
zip ur stuff and PM me

Black_Apalachi
18-07-2009, 09:19 PM
zip ur stuff and PM me

I don't know how to do that lol but the thing I downloaded originally is a zip so you could just check that out.. http://www.habbville.com/site/files/content/free_layouts/zips/L22.zip

Thanks for helping, +rep btw and I'll owe you another ;).

Edit: need to spread so I'll owe you two :P.

I have PMed --ss-- btw given it is his layout and coding but he hasn't been online all day so I thought I'd see if anyone else could help.

Black_Apalachi
18-07-2009, 10:05 PM
Ohhh I've found something which I think is a step forward....


<!-- Start Main Content -->
<?php
$page = $_GET['p'];
if(!isset($page))
{
include("main.php");
}
elseif

(file_exists("". $page . ".php"))
{
include("" . $page . ".php");
}
else
{
print("The

page <b>" . $page . ".php</b> does not exist.");
}
?>
<!-- End Content -->..only that this just makes it display:


" . $page . ".php does not exist."); } ?>I assume I'm supposed to edit this somewhere? I see it has the $_GET['p'] as you mentioned, but adding 'main.php' didn't make a difference...


I always get stuck on something trivial whenever I attempt websites!

Trinity
19-07-2009, 01:40 AM
Ohhh I've found something which I think is a step forward....


<!-- Start Main Content -->
<?php
$page = $_GET['p'];
if(!isset($page))
{
include("main.php");
}
elseif

(file_exists("". $page . ".php"))
{
include("" . $page . ".php");
}
else
{
print("The

page <b>" . $page . ".php</b> does not exist.");
}
?>
<!-- End Content -->..only that this just makes it display:


" . $page . ".php does not exist."); } ?>I assume I'm supposed to edit this somewhere? I see it has the $_GET['p'] as you mentioned, but adding 'main.php' didn't make a difference...


I always get stuck on something trivial whenever I attempt websites!

Why did nobody ask the main question? Do you have PHP installed?
If you don't, either install it or upload the files to a server with PHP installed. Bish bash bosh.

Black_Apalachi
19-07-2009, 01:42 AM
Why did nobody ask the main question? Do you have PHP installed?
If you don't, either install it or upload the files to a server with PHP installed. Bish bash bosh.

Oh, where do you go to do that? :/ if it wasn't installed wouldn't i get a lot more problems?

Trinity
19-07-2009, 01:46 AM
Oh, where do you go to do that? :/ if it wasn't installed wouldn't i get a lot more problems?

Install something like xampp (http://www.apachefriends.org/en/xampp.html), then you get apache, php etc, easy peasy. Then go to http://localhost/whereveryouwant/index.php
BOOSH.
And no, you should only get a couple of problems because I'm guessing the majority of index.php is HTML.

Black_Apalachi
19-07-2009, 01:56 AM
Install something like xampp (http://www.apachefriends.org/en/xampp.html), then you get apache, php etc, easy peasy. Then go to http://localhost/whereveryouwant/index.php
BOOSH.
And no, you should only get a couple of problems because I'm guessing the majority of index.php is HTML.

Ohhh so for script type things you need that? Okies thanks +rep :D

I might just do the headers normally because this is only to edit their titles easily but it won't really be neccessary.

Thankiess!!


btw would that make the content work as well?

Black_Apalachi
19-07-2009, 03:35 AM
This made no difference btw. sigh.

BoyBetterKnow
19-07-2009, 11:25 AM
Why did nobody ask the main question? Do you have PHP installed?

Rofl, I assumed he was building it on his web server or at least had php installed.



This made no difference btw. sigh.

You need to find the directory you have xampp in. If you installed it in C:/ go to C:/ and look for xampp. IF you can't remember then search for the folder called "xampp" and then find httdocs. Then delete everything inside httdocs and put ur files there. Then do what Trinity said and go to localhost/blah. Also, I often have problems when I install it, I have to go to xampp and manually start the mysql php etc.

Black_Apalachi
19-07-2009, 02:28 PM
Rofl, I assumed he was building it on his web server or at least had php installed.




You need to find the directory you have xampp in. If you installed it in C:/ go to C:/ and look for xampp. IF you can't remember then search for the folder called "xampp" and then find httdocs. Then delete everything inside httdocs and put ur files there. Then do what Trinity said and go to localhost/blah. Also, I often have problems when I install it, I have to go to xampp and manually start the mysql php etc.

Yay that must be all I need to do: move all my files into there. I have a folder called "htdocs" rather than "httdocs", is that the right one?

BoyBetterKnow
19-07-2009, 02:43 PM
Yay that must be all I need to do: move all my files into there. I have a folder called "htdocs" rather than "httdocs", is that the right one?

Yeh htdocs sorry ;)

Black_Apalachi
19-07-2009, 02:55 PM
Ok went into htdocs. Deleted everything. Pasted all my files. Reopened index.php from there. Still doesn't work. :eusa_wall

I looked at the source of the original page on Habville and found this instead of a simple include:


<?php
$page = $_GET['p'];
if(!isset($page))
{
include("main.php");
}
elseif(file_exists

("". $page . ".php"))
{
include("" . $page . ".php");
}
else
{
print("The page <b>" .

$page . ".php</b> does not exist.");
}
?>

So I tried putting that in and now it displays this:

" . $page . ".php does not exist."); } ?>



I obviously don't have a clue so I'm sorry for waisting everyone's time :rolleyes:.

BoyBetterKnow
19-07-2009, 03:09 PM
Okay are you going to it through http://localhost/index.php ?

Black_Apalachi
19-07-2009, 03:15 PM
Okay are you going to it through http://localhost/index.php ?

I'm going through file:///C:/xampp/htdocs/site/index.php

what do I need to do to go through "localhost"?

Agnostic Bear
19-07-2009, 03:35 PM
I'm going through file:///C:/xampp/htdocs/site/index.php

what do I need to do to go through "localhost"?

Just go there, it's already there.

Black_Apalachi
19-07-2009, 03:49 PM
Just go there, it's already there.

Page load error... :rolleyes:

Agnostic Bear
19-07-2009, 03:52 PM
Is xampp started? If not, there's your problem.

BoyBetterKnow
19-07-2009, 03:54 PM
Yup, I believe u have to start it manually..

and just type in your web address as : http://localhost

Black_Apalachi
19-07-2009, 03:56 PM
Yes. There's four boxes to tick: Apache, MySql, FileZilla, Mercury (that one's faded though). I've ticked the first one because I saw someone mention it earlier.

Do I need to do something else with XAMPP?

Jahova
19-07-2009, 04:11 PM
Yes. There's four boxes to tick: Apache, MySql, FileZilla, Mercury (that one's faded though). I've ticked the first one because I saw someone mention it earlier.

Do I need to do something else with XAMPP?
No, just Apache for you.

Black_Apalachi
19-07-2009, 04:28 PM
well that says "Error: service not started [-1]" in the XAMPP window thing.

seriously is there any alternatives to this that can just be done in Notepad and doesn't require downloading programmes? Iframes I suppose? Although I'm sure I acomplished this when I coded my own layout from scratch about 6 months ago and I know I used divs, and I didn't have to download anything.

Invent
19-07-2009, 05:09 PM
well that says "Error: service not started [-1]" in the XAMPP window thing.

seriously is there any alternatives to this that can just be done in Notepad and doesn't require downloading programmes? Iframes I suppose? Although I'm sure I acomplished this when I coded my own layout from scratch about 6 months ago and I know I used divs, and I didn't have to download anything.

Not if you want to do it using PHP - which needs a http server (e.g. Apache). Setting up XAMPP is pretty easy, you must be doing something very wrong, lol.

Try this to fix your error: http://www.developersnippets.com/2009/04/29/error-apache-service-not-started-1-xampp-server/

Black_Apalachi
19-07-2009, 05:20 PM
Not if you want to do it using PHP - which needs a http server (e.g. Apache). Setting up XAMPP is pretty easy, you must be doing something very wrong, lol.

Try this to fix your error: http://www.developersnippets.com/2009/04/29/error-apache-service-not-started-1-xampp-server/


Ohhhh you click "start" not the tick box kkkkkkkk lol.

I'm doing that now and I'll let you know if it helps :D. +rep

Black_Apalachi
19-07-2009, 05:28 PM
Ok Apache is running. But it's made no difference.


Right is this 100% correct for an include?

<?php include("main.php"); ?>


And does the document 'main.php' have to contain anything in particular or is there anything it can not contain?

For example, it beins with:

<div class="image1"></div>

...and then it's just text.

Jahova
19-07-2009, 05:28 PM
You need PHP GD?

Black_Apalachi
19-07-2009, 05:42 PM
You need PHP GD?

Someone asked me that before. I don't know what it is but I'll see if I can find it to download...

(edit) oh it sounds like that's to do with images? might help my original problem but I'm more concerned about displaying the actual content for now.

edit again. I have an idea. Could somebody download the zip I posted in an earlier post (previous page I think). Then open index.php in Notepad, scroll to the very bottom and you'll see the 'enter content here' part. It has that weird coding I also posted earlier rather than a php include. That might be the best way for someone to spot a problem?

Jahova
19-07-2009, 05:51 PM
The headers use Php GD to generate the text that is on them. It's not a normal div with a background image and text on top. The image has been generated to have whatever text you want on it.

Black_Apalachi
19-07-2009, 05:53 PM
The headers use Php GD to generate the text that is on them. It's not a normal div with a background image and text on top. The image has been generated to have whatever text you want on it.

Ok thanks, I'll d/l that then :) +rep

Once downloaded, will any action be required? i.e. will it have to be d/l to somewhere around file:///C:/xampp/htdocs/site/ for instance?

Dentafrice
19-07-2009, 05:58 PM
I can't be arsed to read through all of that. But is the problem right now; not being able to display the headers?

If so.. go to header.php?t=blah and see what comes up.. in your browser.. then tell us what happens.

Black_Apalachi
19-07-2009, 06:02 PM
I can't be arsed to read through all of that. But is the problem right now; not being able to display the headers?

If so.. go to header.php?t=blah and see what comes up.. in your browser.. then tell us what happens.

That was my initial problem, but when I work out where exactly to download this Php GD from, it should be OK :).

I have a seperate problem though where by my php include won't work so I can't see any of my content.

Black_Apalachi
19-07-2009, 06:25 PM
I might leave this and code one of my own layouts. I did a lot better doing that last time lol.

BoyBetterKnow
19-07-2009, 06:57 PM
I'm sure XAMPP comes with php gd?

Black_Apalachi
19-07-2009, 08:25 PM
oh, well the headers nor the content is showing up. Thank you all for trying to help me anyway :).

BoyBetterKnow
19-07-2009, 08:30 PM
oh, well the headers nor the content is showing up. Thank you all for trying to help me anyway :).

Ok and what is the URL you are previewing it at?

If u have teamviewer, I will help you.

Black_Apalachi
19-07-2009, 08:51 PM
I'm just opening the file from my computer in my browser.

Dentafrice
19-07-2009, 08:53 PM
That's the problem.. if you have XAMPP running..

http://localhost

Black_Apalachi
19-07-2009, 08:55 PM
That's the problem.. if you have XAMPP running..

http://localhost

**** +REP x A MILLION !!!!!!!!!!!!!


thankkk yoouuuuuuuuuu! I know a couple people mentioned this but I didn't realise they meant "just type localhost in the address bar" :D.

BoyBetterKnow
19-07-2009, 08:56 PM
**** +REP x A MILLION !!!!!!!!!!!!!


thankkk yoouuuuuuuuuu! I know a couple people mentioned this but I didn't realise they meant "just type localhost in the address bar" :D.

I said that loads :S

Black_Apalachi
19-07-2009, 09:01 PM
I didn't realise you meant just that on its own. I'll +rep you anyway if I can :P.

Want to hide these adverts? Register an account for free!