Hello, it's me again.
Here is my current problem, I was pretty sure I was doing it right but I keep getting an odd error.
Basically I have arrays of datas which contain keywords (for a lexicon) grouped by letters, and definitions.
It looks a bit like this:
$letters = array("A", "B", "C"); // etc
$WORDS["A"]["word1a"] = "definition 1";
$WORDS["A"]["word2a"] = "definition 2";
$WORDS["A"]["word3a"] = "definition 3";
$WORDS["B"]["word1b"] = "definition 1";
$WORDS["B"]["word2b"] = "definition 2";
$WORDS["C"]["word1c"] = "definition 1";
|
BUT, some (not all) words' definitions also have SUB-definitions, to display in a list, which would look like this:
$SUBWORDS["word2a"]["a"] = "sub definition a";
$SUBWORDS["word2a"]["b"] = "sub definition b";
|
There are even a few words with third levels of definitions, but I won't go into that now 'cause I can't even solve the second level. ;)
Anyway, so my code looks like this:
$TBS->MergeBlock("letters", "array", "letters"); // Main block: alphabetical letters
$TBS->MergeBlock("words", "array", "WORDS[%p1%]"); // Sub block: words & definitions grouped by letter
$TBS->MergeBlock("subwords", "array", "SUB_WORDS[%p1%]"); // Sub-sub block: lists of definitions under a word's definition
|
And my HTML is as follows:
[letters;block=begin]
<h4>[letters.val]</h4>
<ul>
<li>
<span class="lexiword">[lexicon.key;block=li;p1=[letters.val]]</span>
<span class="lexidef"> ---[lexicon.val;htmlconv=no]</span>
<ul class="lexidef">
<li>[subwords.val;block=li;p1=[lexicon.key;htmlconv=no];magnet=ul;noerr]</li>
</ul>
</li>
</ul>
[letters;block=end]
|
The magnet tag is so that it doesn't display the <ul> in case there are NO sub-definitions. I want the end result to look like this:
A
* Word 1 --- definition 1
* Word 2 --- definition 2
- subdef1
- subdef2
B
* Word 1 --- def 1
* Word 2 --- def 2
etc...
The letters, and keywords/definitions, display properly, but not the subdefinitions. I get the following error:
"TinyButStrong Error (Block definition): [subwords.val] can not be defined because tag <li> or </li> is not found.
TinyButStrong Error (Array value): Can't merge [subwords.val] because there is no key named 'val'. This message can be cancelled using parameter 'noerr'."
So it doesn't find the <li> tag, or I'm doing something wrong?
Sorry if this is long-winded, or if I'm unclear. If I am just ask me what to explain.
Thanks!
(PS: there should be a Preview button on this forum!)