PDA

View Full Version : Create/Add List Code(may be Javascript or Php)



username85
Feb 23rd, 2012, 10:47 AM
Hello,

First of all, I'm not sure if this is in the right category so if it isn't please move it and I will update title is needed.

I would like to create a list of words, kinda like a dictionary list but I would like to be able to add new words in the future without having to affect the rest of the words and their positions. For example, I would like to have, in my content div, three words per line and if I add another word, the rest of the words will shift accordingly. For example, if my list was like this:

a d g
b e h
c f i

and later I wanted to add another 'word' like this:

a d h
a.1 e i
b f
c g

how would I code it so that I wouldn't have to change the rest of the words? I'm presuming I would also have to set a limit to be number of words per column. Also, I know I can do the above horozintally as in

a b c
d e f
g h i

to

a a.1 b
c d e
f g h
i

but I want to the reader to look for the words doing downwards(easier on the eyes). Any help would be appreciated, even if its a suggestion, or points me in the right direction. Thanks.

teedoff
Feb 23rd, 2012, 03:47 PM
Server side language like php, coldfusion, asp, and others can do this along with a database.

Your database would store your dictionary words, and the server side by means of a query could retrieve them and dynamically populate your page content with what is essentially a loop. A loop will allow for new words and will insert them appropriately into the markup.

You would even be able to use server side and insert/update queries to add new words or change existing words without affecting the page template.

No small task for someone with little or no experience. You might want to look into hiring someone or take about a year to learn enough to set something up yourself.

username85
Feb 24th, 2012, 12:20 PM
Update:

Problem solved. I made this harder than it has to be. The solution is simple, create three equal div 'columns' inside content div and that way if i need to adjust the number of words in each column it will be as simple as adjusting the start and end column divs like so;
<div class="content">
<div class="content-left"> <!-- first of three 'columns' -->
a<br />
b<br />
c<br />
</div>

<div class="content-middle"> <!-- second of three 'columns' -->
d<br />
e<br />
f<br />
</div>
<div class="content-right"> <!-- third of three 'columns' -->
g<br />
h<br />
i<br />
</div>
</div>

and if i add a new word all i have to do is change where the column div starts and ends like so:

<div class="content">
<div class="content-left">
a<br />
a.1<br />
b<br />
c<br />
</div>
<div=class="content-middle">
d<br />
e<br />
f<br />
g<br />
</div>
<div=class="content-right">
g<br />
h<br />
</div>
</div>

And there you go.

Thought I'd share it with you guys in case anyone's looking for a similar solution.

teedoff
Feb 24th, 2012, 04:14 PM
Seems like that would be a nightmare to maintain. I thought by your initial post, you wanted a database of words, therefore, server side and queries would be so much easier.

Also your code above is not very semantic using all those break tags. The words should really be in lists then you wouldn't need <br /> tags at all.