Coding Help

Discussion in 'Off Topic Chat' started by oriecat, Mar 30, 2004.

  1. oriecat

    oriecat work in progress

    Joined:
    Jul 7, 2003
    Messages:
    3,118
    Likes Received:
    19
    Location:
    Portland OR USA
    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!
     
  2. markc

    markc TPF Noob!

    Joined:
    Mar 8, 2004
    Messages:
    4,237
    Likes Received:
    6
    Location:
    Rochester, NY Velocity: Unknown
    Can others edit my Photos:
    Photos NOT OK to edit
    Have you used JavaScript?

    window.location.pathname

    gives you your page's path, I believe. If you need help, I'll check in later. Does your server support PHP?
     
  3. oriecat

    oriecat work in progress

    Joined:
    Jul 7, 2003
    Messages:
    3,118
    Likes Received:
    19
    Location:
    Portland OR USA
    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...
     
  4. markc

    markc TPF Noob!

    Joined:
    Mar 8, 2004
    Messages:
    4,237
    Likes Received:
    6
    Location:
    Rochester, NY Velocity: Unknown
    Can others edit my Photos:
    Photos NOT OK to edit
    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.
     
  5. Chase

    Chase I am now benign! Staff Member Supporting Member

    Joined:
    Mar 9, 2003
    Messages:
    7,810
    Likes Received:
    51
    Location:
    Deep in the heart of Texas!
    Can others edit my Photos:
    Photos OK to edit
    TheSupportForum is temporarily missing (until I have some time to migrate it over to the new server :? ).
     
  6. oriecat

    oriecat work in progress

    Joined:
    Jul 7, 2003
    Messages:
    3,118
    Likes Received:
    19
    Location:
    Portland OR USA
    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 )
     
  7. markc

    markc TPF Noob!

    Joined:
    Mar 8, 2004
    Messages:
    4,237
    Likes Received:
    6
    Location:
    Rochester, NY Velocity: Unknown
    Can others edit my Photos:
    Photos NOT OK to edit
    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>
    
     
  8. oriecat

    oriecat work in progress

    Joined:
    Jul 7, 2003
    Messages:
    3,118
    Likes Received:
    19
    Location:
    Portland OR USA
    Mark, I love you! Thank you so much!! :):):):)
     
  9. markc

    markc TPF Noob!

    Joined:
    Mar 8, 2004
    Messages:
    4,237
    Likes Received:
    6
    Location:
    Rochester, NY Velocity: Unknown
    Can others edit my Photos:
    Photos NOT OK to edit
    NP!
     

Share This Page