DNforum.com - Domain Sales, Domain Forum, Domain Appraisals
 
Register Now! Welcome to Dnforum.com You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast and simple so please, join our community today! If you have any problems with the registration process or your account login, please contact us.
Go Back   DNForum - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars > Content Development > Website Development and Design Discussion > Coding/Programming/Languages
Start your Domain Reseller Business Today and Earn Money!
Reply
 
LinkBack Thread Tools Display Modes
Old 06-17-2005, 02:52 AM   #1 (permalink)
/DELUSER
 
BLazeD's Avatar
 
Last Online: Today 05:19 PM
iTrader: (49)
Join Date: Apr 2004
Posts: 2,295
DNF$: 5,485
Location: New Zealand
Country:


Arrow Real Easy PHP/Java Query

I have a site, eg www.house.com

I want one ad to show on every single page, except any page that has www.house.com/forum* in the URL.

For the pages that have www.house.com/forum* in the URL I want to show another ad.

I guess either javascript or PHP could do this.

eg.

Define URL

IF URL=www.house.com/forum*

Then

Display AD2

ELSE

Display AD1

I know how it should work, just not the actual code.

Help much appreciated!!!!

PS: Any questions about what I have said please ask, I really need this help
__________________
PM me with your email address for a Free SEDO PRO Endorsement Code
Want to be accepted into the Number 1 Domain Parking Program? Apply through me to Parked.com!
BLazeD is online now   Reply With Quote
Old 06-17-2005, 03:11 AM   #2 (permalink)
www.LOL.biz
 
Bender's Avatar
 
Name: Daniel
Last Online: Today 03:49 PM
iTrader: (13)
Join Date: Apr 2004
Posts: 1,785
DNF$: 5,170
Location: .ro
Country:


Re: Real Easy PHP/Java Query

Code:
<script type="text/javascript">
//****************configuration **********************//
//string to look for 
lookFor="www.house.com/forum";

//HTML to display when the string was NOT found -take care of the proper quotes embedding-
// do not add single quotes without addin a \ first
HTML1='<img src="http://www.mysolarsystem.com/images/jupiter.jpg">';

//HTML to display when the string was  found
HTML2='<img src="http://www.mysolarsystem.com/images/saturn.jpg">';

//****************configuration ends here  **********************//
w=location.href;

index=w.indexOf(lookFor);
if(index=-1){
//the current URL does not contain searched string
document.write(HTML1);
}
else{
//the current URL contains the searched string
document.write(HTML2);
}

</script>
I hope this helps.
PS:
Java and javascript are extremely different...

Last edited by IT Web Team; 06-17-2005 at 03:32 AM.
Bender is offline   Reply With Quote
Old 06-17-2005, 04:08 AM   #3 (permalink)
/DELUSER
 
BLazeD's Avatar
 
Last Online: Today 05:19 PM
iTrader: (49)
Join Date: Apr 2004
Posts: 2,295
DNF$: 5,485
Location: New Zealand
Country:


Re: Real Easy PHP/Java Query

Cheers man,

I dont think it is working though, because the ads themselves are java and I dont know how to edit them to be compatible with the above.

Some other guy suggested

<? if (eregi('www.house.com/forum', $_SERVER['HTTP_HOST'].'/'.$_SERVER['PHP_SELF'])) { ?>
Display AD2
<? } else { ?>
Display AD1
<? } ?>

But it only displays AD1, even when AD2 is meant to be displayed.
__________________
PM me with your email address for a Free SEDO PRO Endorsement Code
Want to be accepted into the Number 1 Domain Parking Program? Apply through me to Parked.com!
BLazeD is online now   Reply With Quote
Old 06-17-2005, 04:25 AM   #4 (permalink)
www.LOL.biz
 
Bender's Avatar
 
Name: Daniel
Last Online: Today 03:49 PM
iTrader: (13)
Join Date: Apr 2004
Posts: 1,785
DNF$: 5,170
Location: .ro
Country:


Re: Real Easy PHP/Java Query

If you prefer PHP,here is the code.
The JavaScript(not Java!) method works as well, both tested.

Code:
<?
$lookFor="www.house.com/forum";
$url = $HTTP_SERVER_VARS["HTTP_HOST"] . $HTTP_SERVER_VARS["REQUEST_URI"];
 if (eregi($lookFor, $url)) { ?> 
Display AD2 
<? } else { ?> 
Display AD1 
<? } ?>
Bender is offline   Reply With Quote
Old 06-17-2005, 05:00 AM   #5 (permalink)
/DELUSER
 
BLazeD's Avatar
 
Last Online: Today 05:19 PM
iTrader: (49)
Join Date: Apr 2004
Posts: 2,295
DNF$: 5,485
Location: New Zealand
Country:


Re: Real Easy PHP/Java Query

Awesome

I have it going now - thanks a lot!
__________________
PM me with your email address for a Free SEDO PRO Endorsement Code
Want to be accepted into the Number 1 Domain Parking Program? Apply through me to Parked.com!
BLazeD is online now   Reply With Quote
Old 06-17-2005, 10:06 AM   #6 (permalink)
DNF Addict
 
Mr.Domains's Avatar
 
Last Online: 07-14-2008 09:09 AM
iTrader: (148)
Join Date: Sep 2004
Posts: 1,788
DNF$: 0
Location: Geneva, Switz.


Re: Real Easy PHP/Java Query

Quote:
Originally Posted by IT Web Team
The JavaScript(not Java!) method works as well, both tested.
Lol, I get this all the time! In fact, last birthday my wife even gave me a great big "Programming Java Applets" manual, and then was quite affronted when I tried to explain to her that I don't use Java and had no interest in learning how too. - "But you did that JavaScript course last summer and said it had been really useful to you?"
__________________


Offers wanted on BXN.net!
Mr.Domains is offline   Reply With Quote
Old 07-13-2005, 03:38 AM   #7 (permalink)
/DELUSER
 
BLazeD's Avatar
 
Last Online: Today 05:19 PM
iTrader: (49)
Join Date: Apr 2004
Posts: 2,295
DNF$: 5,485
Location: New Zealand
Country:


Re: Real Easy PHP/Java Query

Any idea how to change the PHP version of this code, to include multiple URLs?

ie. abc.com/a.php and abc.com/b.php it doesnt display

But for any other abc.com address it will display?

Cheers
__________________
PM me with your email address for a Free SEDO PRO Endorsement Code
Want to be accepted into the Number 1 Domain Parking Program? Apply through me to Parked.com!
BLazeD is online now   Reply With Quote
Old 07-13-2005, 10:12 AM   #8 (permalink)
Platinum Lifetime Member
 
csmaster2005's Avatar
 
Last Online: 10-22-2007 05:58 PM
iTrader: (6)
Join Date: Jul 2004
Posts: 455
DNF$: 1,655
Location: United States


Re: Real Easy PHP/Java Query

all you'd have to do is change the $lookfor variable.
basically what the script is doing is just checking what the url that is being requested is, then compares the url against the lookfor variable, and does a simple if else statement.
easy to modify for any site.
__________________
Tyler Cruz schooled me in BW, so he won this until May 23rd, 2011 TylerCruz
csmaster2005 is offline   Reply With Quote
Old 07-19-2005, 01:30 PM   #9 (permalink)
Platinum Lifetime Member
 
Last Online: 04-18-2008 05:49 PM
iTrader: (11)
Join Date: Jun 2005
Posts: 524
DNF$: 2,486


Re: Real Easy PHP/Java Query

can u explain the code pleasE?
i m a newbie {learning php} and would like to know wt this code means

Quote:
<?
$lookFor="www.house.com/forum";
$url = $HTTP_SERVER_VARS["HTTP_HOST"] . $HTTP_SERVER_VARS["REQUEST_URI"];
if (eregi($lookFor, $url)) { ?>
Display AD2
<? } else { ?>
Display AD1
<? } ?>
__________________
Bookmark!
unknowngiver is offline   Reply With Quote
Reply



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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 05:19 PM.
Copyright @2001-2008 DNForum.com

Learn Domains
Promote Domains
Research Domains
Buy Domains
Resell Domains
Park Domains
Sell Domains
Build Domains
Host Domains
Trademark Domains
Domain Domains
manage Domains
Appraise Domains