You are not logged in.
Hmm, title seems wrong, but anyway. What I have is a held doc project I'm working on, and its basically converting a mess of different file formats into a structured html file. Unfortunately, I haven't been able to convince my boss to give me a server to put this on so that I can create ruby scripts to do what I want, but instead has decided to just give me some shared drive space .
So my basic question is, anyone know a way using html or javascript to import things into every file so I don't have to copy+paste maintain everythingt things like the navigation menu that appears on all pages?
Writing stories for a machine.
Offline
Javascript includes are one option, though they don't always work.
dreamweaver style templates... dunno if any linux editors support these, maybe nvu.
You could try pycludes:
http://www.buchuki.com/pycludesparser.html
Dusty
Offline
Thanks dusty, unfortunately I can't use a scripting language that browsers don't natively understand, nor 34d party apps for this . Other wise I would have done it in ruby ^^ .
I guess the reason I'm having so much trouble is because I can't seem to figure out how javascript wants me to create the string I want all the pages to share in way that can be included easily. All it is is an unordered list contained within a div tags. I thought that just putting down the whole statement as a string variable in a .js file, along with a method to simple write that varaible to the document, and finally importing that script and calling the method would work, but its not >< . Here's an example:
function write_nav() {
nav_statement = "<div id="navigation">
a_bunch_of_tags_and_stuff...
</div> ";
document.write(nav_statement);
}
# then in the html files
<head>
<script src="scripts/nav_write.js"></script>
</head>
<body>
<script type="text/javascript">write_nav();</script>
</body>
Writing stories for a machine.
Offline
Thanks dusty, unfortunately I can't use a scripting language that browsers don't natively understand, nor 34d party apps for this . Other wise I would have done it in ruby ^^ .
I guess the reason I'm having so much trouble is because I can't seem to figure out how javascript wants me to create the string I want all the pages to share in way that can be included easily. All it is is an unordered list contained within a div tags. I thought that just putting down the whole statement as a string variable in a .js file, along with a method to simple write that varaible to the document, and finally importing that script and calling the method would work, but its not >< . Here's an example:
function write_nav() { nav_statement = "<div id="navigation"> a_bunch_of_tags_and_stuff... </div> "; document.write(nav_statement); } # then in the html files <head> <script src="scripts/nav_write.js"></script> </head> <body> <script type="text/javascript">write_nav();</script> </body>
with a string that is quoted in the form of foo = "bar" you cannot use " within the string. So foo = "<bar where="there" />" will cause an error.
But foo = "<bar where='there' />" is perfectly save, and valid.
Offline
Ah, I forgot to escap the " in the example like I have it in the actual file, but even with that it won't work?
Writing stories for a machine.
Offline
why not build the html dynamically. Write some ruby (or insert fav language here) to do the including for you.
Maybe a simple string replacement. Put in markers like {header} {navbar}.
and have the scripts just replace those instances. Hell, you could probably do it with a few lines of sed.
Then you just have input files, and output files. Maybe not quite as elegent, but probably far more workabe.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
why not build the html dynamically. Write some ruby (or insert fav language here) to do the including for you.
Maybe a simple string replacement. Put in markers like {header} {navbar}.
and have the scripts just replace those instances. Hell, you could probably do it with a few lines of sed.
Then you just have input files, and output files. Maybe not quite as elegent, but probably far more workabe.
That's what pycludes does.
Dusty
Offline
Like I explained earlier, if I had a server I could plop this project on that I could install ruby, hell I'd even take perl, for this I would. Unforuntately I don't have that luxury.
Writing stories for a machine.
Offline
you cant work on it on your desktop, then upload it to the server? I was not talking about a web fired script, but a CLI activated one..ie..you run it yourself before hand.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Hmm, interesting suggestion, thanks.
Writing stories for a machine.
Offline