[pmwiki-users] Commas, Numbers in Categories

Shaney Crawford shaneycrawford at yahoo.ca
Thu Dec 21 22:31:19 CST 2006


Hi there,

The reason I like pmwiki so much is because of the ease-of-use and the
way that it is so powerful with only php (no need for messy
databases).  My favourite feature of the software is the ability to
make categories.  I tend to use this feature more than anything else,
as the sites I make are often archives of information from other
places, so the ability to apply categories to the information is
extremely valuable.

I am having some problems including certain characters (commas,
numbers) in categories.  I posted an article earlier about a problem
that I am having with pagelists and categories (thank you for your
email, Crisses, I will respond soon), but the problems below are
different (and from a different website).

On this site, I am having problems making category pages that have
either numbers or commas in them.  To solve this problem, I thought
maybe I could use a
[[!link | name of link]]
structure to give the link a different name from the actual category
page.  However, it doesn't seem to be that simple a problem.

My question is:

>>>Is there some (simple) way to use commas or numbers in categories?<<<

I have included the details of what I am trying to do (and some
solutions) below, but if someone has encountered this problem before
and there is a simple answer (i.e. "No, there isn't a simple way to
use commas and/or numbers in categories"), please disregard what is
written below and just let me know.




=================
Background
=================

I have a site that has pages that assign metadata to linked documents
(pdf, word, etc.).  For example, for every document, I list the title,
format, and size of the document, along with the author's name and
affiliation, and the event/activity at which the document was used
(most of the documents are research presentations in pdf format)
amongst other keywords.

e.g.

-------------------
Title: The Effects of Something on Something Else
Format: pdf
Size: 0.3MB
Author: Someone With A Name
Affiliation: Institute of Something, Some University
Event: International Event With a Big Long Name that I Want to Shorten
Keywords: Something, Something Else
-------------------

In order to create an easy-to-use database of these documents, I have
coded the page in this way.

-------------------
Title: [[http://linkto.pdf | The Effects of Something on Something Else]]
Format: pdf
Size: 0.3MB
Author: [[!Someone With A Name]]
Affiliation: [[!Institute of Something, Some University]]
Event: [[!International Event With a Big Long Name that I Want to Shorten]]
Keywords: [[!Something]], [[!Something Else]]
-------------------


My problem is with the (1) Affiliation and (2) Event categories.



=================
(1) Problem with Affiliation Category: Commas
=================

The names of organizations often have commas in them.

e.g.
[[!Institute of Something, Some University]]

If I leave the comma in, the pagelist doesn't work properly and that
item is not included in the list, although the link does take me to
the correct page (Category.Institute of...).

I can take the comma out, but if possible I would rather leave it in
as some of these names can be rather long and convoluted, and the
commas are there for a reason.

Test Cases

--SOLUTION 1--
Ideally, I would like this to work, but it doesn't.
a. [[!Institute of Something, Some University]]

--SOLUTION 2--
This works, but is not ideal because the missing comma makes the
organization's name hard to understand.
a. [[!Institute of Something Some University]]

--SOLUTION 3--
This would be fine, if it worked.
a. [[Category/Institute of Something, Some University]]

--SOLUTION 4--
This is again, not ideal because of the missing comma.
a. [[Category/Institute of Something Some University]]

--SOLUTION 5--
If I take out the comma, I could add it back in like this, the way we
do it with regular links, but this doesn't work.
a. [[!Institute of Something Some University | Institute of Something,
Some University]]
b. [[Category/Institute of Something Some University | Institute of
Something, Some University]]

--SOLUTION 6--
This is just showing the final option, for the sake of argument.  It
doesn't make sense to do this, but if it worked, I would do it.
a. [[!Institute of Something, Some University | Institute of
Something, Some University]]
b. [[Category/Institute of Something, Some University | Institute of
Something, Some University]]

--SOLUTION 7--
It is possible to use a hyphen instead of a comma, but only if the
words are stuck together.
a. [[!Institute of Something-Some University]] (works)
b. [[!Institute of Something - Some University]] (doesn't work)


Results

Works properly:
Solution 2(a), Solution 7(a)

Links to proper category page, but doesn't include that item in the
category pagelist:
Solution 1(a), Solution 3(a), Solution 4(a), Solution 5(b), Solution
6(b), Solution 7(b)

Links to "regular" page (Main/Institute of...) rather than category
page (Category/Institute of...):
Solution 5(a), Solution 6(a)

Of course, I can do a workaround with an invisible link that puts the
item on the page and a visible link that takes the person to the right
page.

%comment%[[!Institute of Something Some University]]%%[[!Institute of
Something, Some University]]

This works, but it seems to be rather clunky, so if there is a more
elegant solution, I would like to know about it.  I tried changing the
comma to a semi-colon and that doesn't work.  Hyphens do, but they
don't look very nice because the hyphen cannot have spaces around it.

Ideally, I want to be able to use one of the following.

[[!Institute of Something, Some University]]
(like a regular category)
or
[[!Institute of Something Some University | Institute of Something,
Some University]]
(like a regular link)

If all else fails, I suppose I could just separate the two.

[[!Institute of Something]], [[!Some University]]

But that is also not ideal because an "Institute of Something" at one
university is not the same as a similarly named institute at another
university.  (Documents by same-named institutes would be grouped
together.) I suppose I could also just decide not to provide a link to
items at the "Institute" level, but that would mean an equivalent loss
of valuable cross-referencing data.




=================
(2) Problem with Event Category: Numbers
=================

I am also having a problem with the events category, which includes numbers.

The names of the events are often quite (ridiculously) long (e.g.
International Workshop on the Effects of Some Major Thing on Some
Other Important Thing and their Policy Ramifications), so it is not a
good idea to use them as the name of the link.  (Long links tend to
break in some mail readers.)

I still need to have a unique identifier for each event, so I have
decided to use the date in numerical format (e.g. 20061222).  However,
there are certain problems with using a number as the first letter of
a category, so I have chosen to put an "A" (for "activity") at the
beginning of the identifier (i.e. A20061222).

--SOLUTION 1--
This doesn't work.  The link goes to the right page, but the article
does not get added to the page.
[[!20061222]]

--SOLUTION 2--
This also doesn't work.  Same problem: The link goes to the right
page, but the article does not get added to the page.
[[!A20061222]]

--SOLUTION 3--
This works, but is not very informative to the reader.
[[!A 20061222]]

--SOLUTION 4--
This is what I want to do.  However, the link goes to a "regular" page
(Main/A 20061222) rather than a category page (Category/A 20061222).
[[!A 20061222 | International Workshop on the Effects of Some Major
Thing on Some Other Important Thing and their Policy Ramifications]]

--SOLUTION 5--
This is what I may have to do ("invisible link that puts the item in
the right category" with "visible link that jumps to the category
page" trick), but would rather not, if there is a way to make Solution
4 work properly.
* Event: %comment%[[!A 20061205]]%% [[Category/A 20061222 |
International Workshop on the Effects of Some Major Thing on Some
Other Important Thing and their Policy Ramifications]]




Any ideas?  Basically, I have come up with functional (but clunky)
workarounds, so I can use them as a last resort.  I would like to find
out, though, if there is a more elegant way to do it that I have not
considered.  I would like to keep the coding as simple as possible
(and keep the coding for each of the category pages as similar as
possible) so that I can eventually teach (non-techy) people how to
update the page.  That is why I am hoping to find the simplest
solution.

Also, is there a reason why the commas and numbers don't work properly
as category names?  I can kind of understand why commas wouldn't work,
but it seems like numbers should.  Is there something I am missing?  I
have had to do a similar kind of workaround on a site that archives
issues of a magazine by year, since the year in numeric form doesn't
work as a category -- the category page is created, but the items do
not get included in the page.  The example that is used in the
documentation for categories includes a year category (for classifying
films), so I assumed it *should* work.

Shaney.




More information about the pmwiki-users mailing list