Coding Help

oriecat

work in progress
Joined
Jul 7, 2003
Messages
3,117
Reaction score
19
Location
Portland OR USA
Website
www.moltenwords.net
Is The Support Forum gone? I can't find it... anyway... I am working on some webpages for work and I am wondering if something can be done...

I am creating some indexes to our internal forms that we will be posting on our webspace. I will have 10 branch folders, but most of the indexes will be the same so I would like to just create one master and then upload it to each folder. But I would like it to show the name of the branch. Is there a way to have the page display a part of the full path name?

For example: the path is www.cme.com/forms/location/index.htm

Is there a way to have it pull the location out so I can put it in a header? Without having to just manually type the location in a header, which would mean I would need 10 separate index files...

I hope this makes sense!
 
Thanks Mark. I don't really know anything about javascript, have only used a couple scripts that I have found and used as is...

I did find the following script that pulls the full path and displays as links:
Code:
<script type="text/javascript">
<!-- 
thePath = '';
loc = '' +location.href;
paths = loc.substring(7).split('/');
file = loc.substring(0,6); 
for (i=0, n=paths.length;i<n;i++) {
  file += "/" + paths[i];
  thePath += '> <a href="' + file + '">' + paths[i] + '<\/a> ';
}
document.write(' ' + thePath.substring(1));
//-->
</script>
but it's not exactly what I am looking for and I can't seem to tweak it...
 
markc said:
When you say header, do you mean an <H> tag, or the title of the page?

I can edit it later, but if you can run PHP, there's a nicer way to do it.

Yes, an <h> tag (<h1 id="header"> to be exact!)

Here's what it's doing now:
http://www.moltenwords.net/cme/portland/

I really want it to only say Portland instead of the whole thing...

I think we can probably use php, altho not positive. I just don't know much about that either and am trying to keep the pages simple...

Thanks again! :D

Get working on it, Chase! Man, what a slacker... ;) (just living up to my title! Can't let ya down! :p )
 
Try this:

Code:
<center><h1>
<script type="text/javascript">
<!-- 
loc = location.href.split('/');
header = loc[loc.length-1]
if (header == 'index.htm' || header == 'index.html')
	header = loc[loc.length-2]
document.write(header);
//-->
</script>
</h1></center>
 

Most reactions

New Topics

Back
Top