Unstoppable Domains โ€” Expired Auctions

2 PHP questions

Spacemail by SpaceshipSpacemail by Spaceship
Watch

SiKing

Registered MemberEstablished Member
Impact
6
Hey just got a couple of questions.

1. I have billions of pages on my server and I guess it's time I organised them. However, they all need the "head.php" and the "foot.php". So how can I organise the files into folders and still use the php 'include' function.

2. My logo on my site is a link to the homepage. How can I have it as a link without following my CSS link properties (it underlines when on hover). I've tried assigning it an ID without text-decoration and also used the same method as the attribute 'style' to the actual <img> element.

Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
1. put an absolute link in the include function (i.e. www.abcxyz.com/header.php rather than header.php)

2. Not a php question, but w/e lol. try making a new custom CSS style for images and then assign it to the image in the html file. this way (i think, not a css expert) itll override the generic hyperlink code.
 
0
•••
1. Didn't work

2. The links in 'head.php' will not work unless - Is it a good idea to change the links in the 'head' with the following example:

Should:
index.php be www.whatever.com/index.php?
 
0
•••
Can you dump the source of one of your pages here... So we can see how your doing the include?

PHP:
include('http://www.whatever.com/header.php');

Should work.

on the CSS issue, I don't have a clue.

miseria said:
1. Didn't work

2. The links in 'head.php' will not work unless - Is it a good idea to change the links in the 'head' with the following example:

Should:
index.php be www.whatever.com/index.php?

If your pages are in different directories, then yes, you'll have to give it an absolute (just like you have it) url rather than a relative one. If you have 'index.php' as your link, the link won't work because the pages are going to look in their current directory for the index.php, not your web root.
 
0
•••
Sorry, I got 1 and 2 wrong way round >.<

Should I use the URL or the web root for includes?
 
0
•••
hmm!

you could use ini_set() and change the dirs?

Although, this could cause problems in the long run.
 
0
•••
alternatively you could use

include ("../head.php");

The ../ means previous directory... so if it was 3 directorys before you'd put ../../../head.php
 
0
•••
Thanks guys. Just stuck on the image/link thing now :(
 
0
•••
miseria said:
Sorry, I got 1 and 2 wrong way round >.<

Should I use the URL or the web root for includes?

You mean:

PHP:
include("http://www.mysite.com/header.php");

vs.

PHP:
include("/home/myusername/public_html/header.php");

?

Both will work.

The first method is slower, because PHP has to make a request to resolve the domain. However, it's portable.

If you want to go with the second method, do this, it's fast and is portable for when/if you change hosts.

PHP:
include($_SERVER['DOCUMENT_ROOT'] . "/header.php");

That will take the document root from PHP and grab the header.php from there.
 
0
•••
using an http request will not always work. If you have variables being set in the header.php file that you want to be accessible by the current page, you won't be able to use them.
 
0
•••
clowesy said:
alternatively you could use

include ("../head.php");

The ../ means previous directory... so if it was 3 directorys before you'd put ../../../head.php

ah i didnt know that... i was wondering if that was possible lol thnx for the tip. :wave:
 
0
•••
Kodeking said:
using an http request will not always work. If you have variables being set in the header.php file that you want to be accessible by the current page, you won't be able to use them.

Ah, that's right... the page would be processed before being included...

Okay, scratch that suggestion...
 
0
•••
Still need help with this CSS thing.

www.darkfx.co.uk

You'll see what I mean if you hover over the logo.

Thanks
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back