Webmastersite.net
Register Log In

Catch part of the url you are on
Everything is possible. But what about this?

Comments on Catch part of the url you are on

david
Forum Regular

Usergroup: Customer
Joined: Jun 22, 2005

Total Topics: 91
Total Comments: 305
david
Posted Jul 21, 2005 - 10:00 PM:

Hey Paul,


Here is the idea. Setup a subdomain for a site, such as david.thissite.com . Obviously David would be a registered member in the database. I would need to somehow use 1 WSN on all the subdomains that I set up on the server (this is a sys admin's job, but I would appreciate some suggestions). Then when somebody visits david.thissite.com, they will see the normal template and the real site, with the exception that the url will always remain david.thissite.com .

THEN, for example, David has his own page on one of the listings in the directory. Let's say there is a listing called puppies.com and David has his own blog there, called puppies.com/david .

So when somebody clicks on the URL of the listing in my directory, AND they are on the subdomain 'david', then I need to be able to append 'david's information that relates to THIS particular URL.

Obviously, there would be no duplicate usernames and subdomains, so whatever the subdomain is, that would be an active username and member in the database.

Obviously, if the member, whose subdomain you are on, doesn't have anything listed for a certain URL, then there has to be a default for that URL (such as www.) to append.

So, if there is a listing in the directory called dogs.com and David doesn't have his page on dogs.com, then when somebody visits david.thissite.com and clicks on dogs.com, there would be nothing appended to the end of that url and the visitor would simply goto dogs.com

So really, I would need something like {THISDOMAINOWNERSOWNPAGE} to be able to append to the actual urls in the profile of the link. So a business can submit their url, and tell me that the way they format their own member's urls, are "http://www.dogs.com/memberspages/username" . In this case, I would quite literally change the URL of the business to "http://www.dogs.com/THISDOMAINOWNERSOWNPAGE} .

In this case, theoretically (if a script is created that captures the subdomain the visitor is on, and can pull up information about the owner of the subdomain), if I visited David's site and David had a page of his own at dogs.com, then when I clicked on dogs.com, then I would be taken to David's page at dogs.com

I would most likely need a field as well to allow members to enter their page info in their Members area. Probably a text field, where they can enter the ID of the link that they have a page url for.
This php script would have to do something like this (when somebody visits a subdomain):
- identify if subdomain
- determine subdomain
- look up member by the username, match with subdomain
- look at link URLs on the page displayed
- determine links' IDs
- look to see if the subdomain owner has any of the IDs listed in that particular field in their profile
- if ID is found, match with link on the page
- retrieve page info from member's profile for that link
- append this info to the {THISDOMAINOWNERSOWNPAGE} part of the URL


I know that I write in a round-about way. Sorry. I like to explain stuff a million times, to make sure it's understood. smiling face

I would like to hear your thoughts on the possibilities of achiving the above. Who would be interested in this project? What would this entail? Any thoughts?

THanks
David
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jul 22, 2005 - 3:43 PM:

{CURRENTURL} is the current url of the page being viewed, and you can get a domain out of that, mostly easily just doing <IF {CURRENTURL} contains david.thissite.com>blah</IF>

If you're dealing with that in editing a php file just call the currenturl() function, like
if (strstr(currenturl(), 'david.thissite.com')) $url .= $thislink->extrastuffforurl;

But if you need something more flexible and don't want to parse apart the url, $_SERVER['SERVER_NAME'] usually works for getting the david.thissite.com by itself -- though on some server configurations this will give a wrong result. To get david out of that you could do a quick $ownername = explode('.', $_SERVER['SERVER_NAME']); $ownername = $ownername[0];

Getting the URL to to stay the same would mean using a more complex method to specify $dirurl in config.php but still along the lines of the manual.
david
Forum Regular

Usergroup: Customer
Joined: Jun 22, 2005

Total Topics: 91
Total Comments: 305
david
Posted Jul 22, 2005 - 4:01 PM:

I am sure people have told you before, but I am gonna say it again.

Your script, with a little tweaking, can pretty much do ANYTHING. I am truly impressed. You will definately be hearing from me for some re-distribution deals. wink

Thanks
David
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.