NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page 2 PHP questions

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
2 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 09-20-2005, 12:37 PM THREAD STARTER               #1 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




2 PHP questions


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
Encenta.com is offline  
Old 09-20-2005, 12:43 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



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.
nasaboy007 is offline  
Old 09-20-2005, 12:54 PM THREAD STARTER               #3 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




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?
Encenta.com is offline  
Old 09-20-2005, 01:00 PM   #4 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Can you dump the source of one of your pages here... So we can see how your doing the include?

PHP Code:
include('http://www.whatever.com/header.php'); 
????: NamePros.com http://www.namepros.com/programming/125307-2-php-questions.html
Should work.

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

Originally Posted by miseria
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.
__________________
OnlineGames.net
slantednet is offline  
Old 09-20-2005, 01:05 PM THREAD STARTER               #5 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




Sorry, I got 1 and 2 wrong way round >.<

Should I use the URL or the web root for includes?
Encenta.com is offline  
Old 09-20-2005, 01:07 PM   #6 (permalink)
Account Suspended
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

hmm!

you could use ini_set() and change the dirs?

Although, this could cause problems in the long run.
axilant is offline  
Old 09-20-2005, 01:16 PM   #7 (permalink)
Account Closed
Join Date: Aug 2005
Posts: 373
clowesy is a jewel in the roughclowesy is a jewel in the roughclowesy is a jewel in the rough
 



alternatively you could use

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

The ../ means previous directory... so if it was 3 directorys before you'd put ../../../head.php
clowesy is offline  
Old 09-20-2005, 01:21 PM THREAD STARTER               #8 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




Thanks guys. Just stuck on the image/link thing now
Encenta.com is offline  
Old 09-20-2005, 01:21 PM   #9 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Originally Posted by miseria
Sorry, I got 1 and 2 wrong way round >.<

Should I use the URL or the web root for includes?
You mean:

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

PHP Code:
include("/home/myusername/public_html/header.php"); 
?
????: NamePros.com http://www.namepros.com/showthread.php?t=125307

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 Code:
include($_SERVER['DOCUMENT_ROOT'] . "/header.php"); 
That will take the document root from PHP and grab the header.php from there.
__________________
OnlineGames.net
slantednet is offline  
Old 09-20-2005, 01:26 PM   #10 (permalink)
Senior Member
 
Kodeking's Avatar
Join Date: Jun 2003
Location: Naperville Illinois
Posts: 1,786
Kodeking is just really niceKodeking is just really niceKodeking is just really niceKodeking is just really nice
 



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.
__________________
Quote:
Clan-Forums.com >> $30 BoardingForum.com >> $100
TalkWebHosting.com >> $200 AvoidChapter13.com >> $100
Send PM to make lesser offers on the above names.
Kodeking is offline  
Old 09-20-2005, 02:46 PM   #11 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



Originally Posted by clowesy
alternatively you could use
????: NamePros.com http://www.namepros.com/showthread.php?t=125307

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.
nasaboy007 is offline  
Old 09-20-2005, 03:04 PM   #12 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Originally Posted by Kodeking
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...
????: NamePros.com http://www.namepros.com/showthread.php?t=125307

Okay, scratch that suggestion...
__________________
OnlineGames.net
slantednet is offline  
Old 09-21-2005, 11:25 AM THREAD STARTER               #13 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




Still need help with this CSS thing.

www.darkfx.co.uk

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

Thanks
Encenta.com is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 11:35 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
RSS (PHP and google) questions traderone Web Design Discussion 8 07-28-2005 02:38 PM

 
All times are GMT -7. The time now is 12:13 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger