HTML variable?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Judith1945
    New Member
    • Nov 2006
    • 3

    HTML variable?

    I apologize if this is too often asked. I've just spent way too much time looking for an answer to no avail.

    I'm doing some major documentation that is split into various files. I want to create a variable with the directory path in it to enable easy movement of the files to a different location when/if necessary.

    How do I define a variable `path' ($path ?) so the string I define it to be is used in a reference? Currently, my references look like:
    <a href="{$path}/file.html">
    I realize that this may not even be the correct format. If it isn't, then I also need to know how to reference it.

    Thanks much--

    Judith
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    This is not an html problem, but is more on the (PHP) side. if you define your path as [php]
    $path = './mypath';
    echo "<a href='$path/prog.php'>xxx</a>";
    [/php]
    it will work.

    Ronald :cool:

    Comment

    • Judith1945
      New Member
      • Nov 2006
      • 3

      #3
      Ronald--

      Thanks for the quick reply but I'm still in trouble. My ignorance is really showing.

      I have the variable definition in the <head> section at the start of my first file:
      <var>$path="/xxx/yyyyy/ddddd"</var>
      Is this where it should be and how it should look?

      Then, I have repeated references in the regular text, in lists, in tables, etc.
      My references look like
      <a href="($path}/file1.html">Fil e1 Content</a>
      This is clearly wrong but I don't understand how to work the php program in nor what I should actually put in the php program.

      Thanks again.

      Judith

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        It looks like the first file is some sort of configuration file in XML format (file type .xml). There must be a script to process that.

        The second one looks like a template file (file type usually .tpl), because of the braces and it not being a server side script file like php, but HTML with to-be-replaced variables.

        Usually, when filling a template (i.e. generating a html script), variables are replaced by the defined constants/variables in the XML file, in this case the path.

        I am afraid the information is not enough to advise you on. Please show some of the code in case uyou want to pursue this further.

        Ronald :cool:

        Comment

        • Judith1945
          New Member
          • Nov 2006
          • 3

          #5
          Ok, I'm definitely messing you up by showing what I've been trying to do. Let me take another approach.

          I have several text files--absolutely nothing fancy--that I've done using html markup so I can display them on the web using file:///....
          These files reference one another in tables, lists, and text.

          Let's take two files: /xxx/yyy/file1.html and /xxx/yyy/file2.html. I want to link back and forth between them. Currently, I'm using
          <a href="/xxx/yyy/file1.html">Fil e1 Contents</a>
          or <a href="/xxx/yyy/file2.html">Fil e2 Contents</a>
          This works fine with the hard-wired full path names. However, I want to replace the "/xxx/yyy" with some MARKER (maybe variable is the wrong word in this context) that contains the string "/xxx/yyy" so my references can look like
          <a href="MARKER/file1.html>File 1 Contents</a>

          That's all I want to do. I simply want the path to be in just one location so if I move the files to some other directory, I don't have to go through looking for all the cross-file references but just have to change the one line where I defined the MARKER.

          Does this make it clearer? I can't tell you how much I appreciate your taking the time to help me with this.

          Judith

          Comment

          Working...