Syntax for variables in html directory path - html

I have a page with loads of repetitive directory paths for images, and all of those images need to replace with new files (that are the same file name, but in a different directory) when duplicating the page. Rather than updating the folder name in each directory I'd like to replace it with a variable and just change that variable once when duplicating pages.
I've tried a bunch of different combinations (like below) but I can't find anything that works, and google efforts were unsuccessful.
var Shirtloc='Shirts/FolderNameThatWouldBeUpdated/'
<img src="'Shirtloc'+title.gif" width="952" height="119">

HTML is not a programming language but a markup language and as such does not provide variables or any other programming tools. This is where serverside scripting comes in, with PHP, ASP.NET and JSP as the most common examples.
Technically, you could do it with Javascript as well but you should not attempt to do that, as it comes with a myriad of problems and possible future issues that you really would not want to deal with.

Related

Website structure issue

I have a multi-language site organised into directories (e.g., pages_EN, pages_FR, etc.), each directory containing webpages such as index.html, contact.html, and referencing common files in separate directories (e.g., "../images/picture.jpg") and external css and js files. This structure has allowed me to copy the code wholesale when adding a new language, only then needing to edit the prose content/text of each.
The problem is now that I'm ready to go live, my web host requires that I have a page called 'index.html' in a directory of theirs (called 'html_public'); this will completely break my page navigation. I can't put all of my language index pages in that directory (because they're all called index.html) and I can't re-name them (e.g., to 'index_EN.html') because of the aforementioned naming requirement.
Must I redesign the whole site? Is this convention common/the rule, or have I just picked the wrong host? If I have just a single (say, English) index page in 'html_public' with all of the others in their respective language directories, then I'm concerned that the content of those other pages might not be indexed. Does anyone have any suggestion about what to do here -- I thought I was structuring this site the right (i.e., simple) way, and now I find that I've got to put twists and turns in to get it online...
If answering, please don't suggest that I just add auto-translation to a single language site -- I'm polylingual, and I've seen how translation software mangles content.
This is common, the server wants an index.html file. A quick and painless solution for you would be to rename your index_EN.html file to index.html and use it as the home for everyone, from there, you can go to the other languages. A more complex but cleaner solution, would be to create an index.php file and in there read the language of the browser visiting your site and redirect to the correct index file.
This should get you started with the php solution Detect Browser Language in PHP

Pretty-print Lua source-code in external file, without embedding it in the HTML file

Since my experience with HTML is fairly rudimentary (and pretty old), I am not sure if my requirement is realistic.
Lets say that I have quite a few files containing Lua source-code, and all of them have the ".lua" extension and available in a particular subdirectory. What I'd like to do is create a static index.html file, which when loaded in a browser, would show the list of the lua source-code files in a drop-down. Once one of the source-code files is selected, I'd like that the file gets loaded into an "area" on the same page, and is pretty-printed, i.e. with syntax-highlighting in browser. I was wondering if I could use something like the google-code-prettyfy for the syntax-highlighting part ? Also, I am not clear if an external lua sourcecode file can be loaded, and displayed within a certain region of html page as being rendered. If yes, would appreciate elaboration on the how part.
A tool like LDoc can be used to accomplish a lot of what you want, much as Doxygen would be used for a C language source kit.
Both are heavily driven by inclusion of specially formatted comments that carry documentation.
I know Doxygen can fold source code into the generated document set, I don't recall about LDoc. Both are actively under development.
It isn't necessarily a bad idea to use both tools on a project, especially if you have C source code implementing Lua modules. You could use Doxygen to build the overall document tree for your engine and C modules, and LDoc to build documentation of the Lua parts. It should be possible with a little care and configuration of both tools to get them to play well together.

Copy and paste articles/namespaces

This might be a far fetched question, but here it goes:
I'm trying to configure a MediaWiki and I'm grouping content into namespaces. I need to find a reasonably easy way for copying a namespace (including content) and pasting it with a different name. First of all: is this possible? Are there any extensions for this? I've looked a bit at the MediaWiki database and I can implement my own software if it is needed, but there are a lot of tables, so if you can give any guidelines it would be nice!
Well this was easily solved. Just export everything by using Special:Export (Special:AllPages can filter by namespace). You can then parse the exported file and change for instance the content between each <title> tag to whatever you want. For example the name of the namespace or subpage you want to transfer the content to.
When you're done you just import it back by using Special:Import.

Objective-C - Parsing a .csv, extracting and inserting information, then displaying the .csv as an interface for editing

This question has been troubling me for the past week. Below, I will list my issue, and the research I have put into it.
The scenario: I was given a .csv file with 5000 rows and three columns. The three columns are defined as:
Site ID|Site Name|Site URL
My task: To create an HTML interface for the designers of the company to rate each site on a scale of 1-5.
My plan of action: I am a new hire. I am getting accustomed to the language I was hired for, which was Objective-C.
My algorithm for the project was to:
Parse the .csv
Remove the "Site Name" variable
Create a new .csv that contains the below variables: Site ID|Site URL|Rating|Image
Display the new .csv (with all aforementioned items) as an HTML page where there are toggles for "Ratings", which when pressed, will log the rating into the .csv which it was imported (or loaded) from.
The "Image" section I will be using a piece of software by the name of Paparazzi (on the Mac OS X operating system) which takes a fully formatted screenshot of the main page and saves it as a PNG file. I plan on using the file extension URL (which is stored locally) and load it into the "Image" column, thus when the designer clicks on the image, he is able to load the image that is stored locally.
My issue: As Objective-C is not entirely a scripting language, I am confused with some of the libraries I may need and/or methods I can implement this. I have the algorithm, but I am wholy unsure with the implementation.
My questions: If you have done a project similar to this before with Objective-C, what tips can you provide for me? How does one load the .csv as a HTML interface where upon edit, it will save this edit into the .csv? Will I need any servers for this, or is everything executable from just a machine? How do you grab an image (stored locally), extract its file extension, and load it onto the .csv?
The most important question: Is this achievable through Objective-C? My reasoning behind it is, I want to advance my knowledge of OC through a task like this. Yes, using Python is easier, but is it possible to do this with Objective-C?
Thank you.
It certainly is achievable, but I doubt you'd really want to go this way. If I understand it correctly, you want to serve the HTML page to others via web browser - that would mean either writing a (simple) http daemon, that would run on the server or writing a CGI script that would communicate with a standard http daemon. Python/PHP/Ruby do this for you readily, so there is much less room for possible errors.
As for
As Objective-C is not entirely a scripting language
I would perhaps rephrase it as
As Objective-C is entirely not a scripting language

Object-oriented HTML without server side code. Possible?

Is it possible to reuse HTML tags across multiple files, headers and footers for example? Placing them in separate files adds an extra HTTP request, that I'd like to avoid.
I don't want to replicate minor changes in headers and footers across every html file every time a change request comes along.
HTML is not a programming language - it's a markup language. You don't do object-oriented HTML because it isn't object based. This is the whole purpose of a server-side language, so you can make include files and use them in your server-side application.
If you have Apache however, you can use server-side includes which don't require a programming language such as PHP, but it's less flexible:
<!--#include virtual="/footer.html" -->
First, HTML isn't even a programming language, so it's impossible to have "Object-oriented" HTML.
Placing them in separate files adds an
extra HTTP request, that I'd like to
avoid.
If this is the reason for your "without server side code" requirement, then you are mistaken - the client does not fetch the templates that make up a page separately; the server side code will return a single HTML page to the client.
If, on the other hand, you don't have the option to run any server-side code at all and have to make do with static HTML pages, then there's only two options I can think of: iframes (which do result in separate HTTP requests, of course), or some sort of tool that basically runs the equivalent of server-side code to embed your reused templates everywhere and spits out the result to be uploaded to the server. You can have this effect by running a PHP/Apache-with-SSI/JSP/Whatever server on your development machine and using wget to make a static snapshot of the pages.
What I want to do is this. The files can be scattered during development. But I when I'm ready to release, a toolkit should compile the included files into a single html file.
You can use a template language/engine, such as jinja2.
You can layout files in a certain hierarchy, and have templates inherit from other templates, and include other templates, and define reusable macros (closest thing to what you referred to as "reusable tags").
What I want to do is this. The files can be scattered during development. But I when I'm ready to release, a toolkit should compile the included files into a single html file
I know this is late, but CodeKit's .kit language lets you do exactly what you were saying.
http://incident57.com/codekit/help.php
I think the language you've chosen in your question (object oriented HTML) is actually masking the real issue you have here...
What I want to do is this. The files can be scattered during development. But I when I'm ready to release, a toolkit should compile the included files into a single html file.
This sounds like a job for a preprocessor, I don't believe it has anything to do with your webserver or server side technology, as this is a step which would happen before deployment.
There's a number of text pre-processors available eg M4 - hell you could even use the C compiler pre-processor if you wanted. A quick google reveals that there are specialised pre-processors for HTML as well....
Automatic file inclusion, automatic escaping, and whatnot that can be done with automatically inserted headers and footers, chosen based on path patterns.
Seems to fit the bill?
Sure . But these would have to be separate ajax calls form the client . There are lot of javascript mvc frameworks like that do that .
If you want to have include files during development, then compile them into free-standing HTML files, you could do that by spidering your development server with wget: whatever server-side technology you use will combine the files and return the HTML, which wget will saves as one file.
As everithing is object over the technology but not directly, indirectly interacting with the object that are created at different level as per security implementation.
You can do this.
I just released a mature framework called Hypertag that is, in fact, Object Oriented HTML. It is entirely client-side, in continuous development, and allows for very interesting, yet HTML-compatible, advanced solutions for logic and layout.
See http://hypertag.io for more.