Topic: Includes with JS? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28599" title="Pages that link to Topic: Includes with JS? (Page 1 of 1)" rel="nofollow" >Topic: Includes with JS? <span class="small">(Page 1 of 1)</span>\

 
krets
Paranoid (IV) Mad Scientist

From: Right-dead center
Insane since: Nov 2002

posted posted 11-01-2006 00:07

I'm helping my girlfriend with a site she's been working on and I'm trying to figure out a quick and easy way to create some pages on the fly.

Basically this company she's designing for has about 40 different pieces of equipment and needs to create pages for each one. They are absolutely not interested in any kind of shopping cart/database system (I have no idea why). So what I was thinking is that I could use JS to define a couple variables at the top of a template page and then use those variables to insert as the title, captions, alt tags, etc.

Like:

Define - %%thisisaname%% as a var so she could change that name at the top.

Use - <img src="[[defined variable]].jpg">

So she would change that variable once at the top of each new equipment page and it could be inserted a number of times in the code below without a bunch of find/replace or copy/paste.

Am I clear as mud on what I'm trying to do?

:::11oh1:::

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 11-01-2006 00:43

Sure you can have an array of objects with the title, description, price, reference, image, ... of each of the ~40 pieces of equipment and use i.e. a parameter sent in GET ( location.search ) to know which one to display.

You could even have a default object so if a property is not set for the desired piece, say the title, you could fallback on the properties of the default object.

One detail though, since all the content will be injected in JavaScript, the pages won't be indexed properly by the search engines. I know they are not interrested in having a DB or shopping cart but they might interrested in having some visitors on their site, or in having an accessible website.

Considering the fairly small amount of items, making a fully static site is not impossible at all. Note that any text/html editor worth its name have templates, macros, search/replace in multiple files, ... which makes it easy to maintain those ~40 pages.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu