Forum Moderators: open

Message Too Old, No Replies

write based on string in uri

         

illtron

11:01 pm on Jan 6, 2007 (gmt 0)

10+ Year Member



Hopefully somebody can help me find the best way to address this. I'm working on changing the directory structure of my employer's site. We've got dozens of indexes, and we're looking to reduce this as much as possible. I'm doing most of this with their server side scripting language, but we have ad profiles that we'd like to keep.

Our ads department schedules ads to something like http://example.com/path/to/the/index.ext?article.xml.

I'm trying to determine the best way to write this old directory to the ad code in the new pages, which would be something like http://example.com/index.ext?subject?article.xml

I think I'd need to create a hashtable or something tha pairs the old directory path with the new subject string.

something like this...

subject1 = /path/to/theoldpage/
subject2 = /path/to/anotheroldpage/
subject3 = /path/to/yetanotherpage/

...where subject1, 2, and 3 are the string in the new uri.

I need to grab that and then just document.write it somewhere-- *I think.*

Can anybody help me get started with this? I'm sort of stumped as to where I should start with it.

Thanks!

[edited by: encyclo at 1:48 am (utc) on Jan. 8, 2007]
[edit reason] switched to example.com [/edit]

mehh

3:16 pm on Jan 7, 2007 (gmt 0)

10+ Year Member



im not sure what your trying to to hear. if you are just looking to redirect to where the adverts you may want to use .htaccses. if im wrong just ignore me.

illtron

12:20 am on Jan 8, 2007 (gmt 0)

10+ Year Member



I'm not looking to redirect. I'm looking to put the old page's ads on the new page by making the ad system think the old page is loading.

I just need to write the old page's URI into the ad code in the new page.

But that's not really important. What I NEED to do to accomplish this is take a string from the NEW uri and based on that, write the OLD uri. I realize that ideally, there would be a database to do this with, but it's just not in the cards right now. A hash table or XML file could be done however. Can anybody help get me started?

illtron

6:08 pm on Jan 8, 2007 (gmt 0)

10+ Year Member



Maybe I'm being unclear with this. I'll simplify if as much as possible:

If the page's URI contains a given string, write another string. The values will come from an array, like this (I think I've got this right).


var oldindex = new Array()
oldindex[baseball] = "/sports/baseball/index.html"
oldindex[football] = "/sports/football/index.html"
oldindex[soccer] = "/sports/soccer/index.html"
oldindex[hockey] = "/sports/hockey/index.html"

So, if the new page is [website.com...] I want to write "/sports/baseball/index.html" somewhere. Anybody?