1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

HTML Document name

Discussion in 'Help' started by Vortix, Sep 29, 2014.

  1. Vortix

    Vortix Active Member

    Is there a way to get the name of a document? I'm trying to include a document however there's one issue: It has the name of the page it's currently on printed on the page header, I want to be able to change this.
    So basically, what I'm wanting is a way, if a document is called index.html, for it to give me the value "index", "index.html", "Index" or similar.
    Is it possible?
     
  2. What do you mean? You want to change index.html to index?
     
  3. Vortix

    Vortix Active Member

    No, I'm wanting to get "index" inside the HTML document
    So: help.html returns "help"/"help.html", index.html returns "index"/"index.html"
    I just want to obtain the name of the file I'm viewing.
     
  4. Hoonigan

    Hoonigan The giver of Le Box Rating. Clockwork Customer

    If you mean the name in the tab above, you need to use
    Code:
    <title>"Text here without quotes"</title> put that in your header.
     
  5. Vortix

    Vortix Active Member

    No, no. I literally mean the name of the document.
    index.html is called index, help.html is called help, game.html is called game, etc.
     
  6. vexus

    vexus ej rockwell's worst nightmare Legend Clockwork Customer

    So you want to call the title of your page into your HTML codes and stuph? Or am I misinterpreting you?

    Speak English Vortix.
     
  7. Hoonigan

    Hoonigan The giver of Le Box Rating. Clockwork Customer

    Ahh if you are a Linux user it should show how ever gathering not. So to display file extension types in Windows environment simply press left alt in explorer meaning file browser, click tools, and then folder options, and then view. And untick "Hide extensions for known file types".
     
  8. What webserver are you using?
     
  9. Hoonigan

    Hoonigan The giver of Le Box Rating. Clockwork Customer

    Ohh I get it if it was example.com/index.html he was example.com/index. This is done via .htaccess. So add the following.
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.html [NC,L]
     
  10. Vortix

    Vortix Active Member

    To Alex: I'm hosting the website on a VPS, Debian OS.
    To Shaun: Not quite, read below, but useful information, so thanks.

    ;-;
    Okay, so say I'm currently on https://testsite.com/testpage.html
    In the HTML of that page I'm hoping there will be some way of obtaining the value "testpage.html" or just "testpage"
    All I'm wanting is to get the name of the file that is currently being viewed, and, for the sake of example, print it out.
    So, as I'm on testsite.com/testpage.html, it will print on page "testpage", or it will print "testpage.html".
     
  11. Code:
    <script>
    var path = window.location.pathname;
    var page = path.split("/").pop();
    console.log( page );
    </script>
    
     
  12. Vortix

    Vortix Active Member

    Perfect! Thanks, exactly what I was wanting.
     

Previous Readers (Total: 0)