Running CuteMarks
Some basics about how it works
CuteMarks is quite simple: Two tables are storing categories and link nodes
in a tree like structure. Categories can contain link nodes and additional
categories, link nodes just sit at the end of the tree. There is virtually
no limit in depth of the tree nor in size. I've made some tests with 1,000+
nodes beeing handled in a friction of a second on a dedicated 1,4 GHz Athlon
machine from calling the script on the webservers until giving back the
output.
The "tricky" (in fact, it's really quite simple) part is, that
the information about the category nodes, that shall be displayed in an
exploded view, are handed over the script as parameter within the URL.
Each link in the tree conserves the full state of all opened category
nodes...confusing? It just means, that if you click on another part of
the tree to explode or implode if partially the script "remembers"
also all other category nodes that shall be exploded. Because this information
can be "hidden" in the URL completely there's no need to use
cookies or Javascript - which makes CuteMarks not only usable even for
the oldest or smallest browser app but also for other platforms like WAP
which don't support such frisky features.
The main object - see below on a description how to use it in your own
code - works quite simple: When initialising it reads all nodes from the
database into memory. This might look like as an expensive operation but
in fact it isn't: The amount of a "normal" bookmark collection
data is normally quite small and the database handles "SELECT *"
queries really, really fast. Of course, handling a 40K+ bookmark collection
can be though of very memory consuming, but you may want to use something
other than CuteMarks for such a large collection anyhow. And because the
whole collection is now in memory the remaining stuff can be done really
fast as no further database reads are necessary. Some arrays are created
in memory from this data which help to display the final tree and finally
the tree itself gets drawn node by node. Please have a look in the - I
think ,-)) - well documented code for further details.
Using the object interface to the tree view
This section is intended to be used if you plan to have the tree displayed
somewhere from your code. You may create a wrapper or whatever with just
a few line of code. If someone writes a wrapper for a portal like phpNuke,
please drop me a mail as I'd like to include this in the core distribution
of CuteMarks.
[# Interface to be described here #]
Use CuteMarks from a public users view
The user interface is quite simple
- Click on "[+]" to expand any category nodes
- Click on "[-]" to implode them.
- Click on the url to be transfered to the url
- The number of hits each URL had already is shown at the right of each
link. If you use the provided stylesheet, this is a broad grey, because
I consider this as a minor important information at therefore it gets
displayed in a minor noticeable style.
Use CuteMarks from an admins view
This is also very straight forward. Additionally to the above user provided
functions each link and category features a set of additional functionalities,
each of them accessed by clicking on the appropriate text behind the URL
or category name:
- [add link]: Adds a new link to a given category
- [add cat]: Adds a cat beneath the current category
- [move]: Moves category or link to another parent
- [rename]: Renames the category
- [delete]: Deletes category or name. ATTENTION: Deleting a category deletes all it's subcategories and links without any request.
When you move something anything you're presented
with a new screen, asking you for the appropriate details.
If you want to setup the script in a way that by clicking on a link a
specific part of the tree gets already opened, just add a "?node_exp=<cat_id>"
to the "index.php" HREF-link as parameter where <cat_id>
is the id of the category you want to have shown. If you want to show
more than one category in exploded view just put them one after another
separated by a comma.
Sorry guys, no magic, just some simple stuff *gg*
Customising CuteMarks
Customising CuteMarks is easy and makes fun ,-)) Read the following section
and setup you personalised version within a hour (or so... g)
Templates
Every PHP script has a name matching template in the ./templates directory.
E.g. the index.php uses ./templates/index.tpl. So if you want to add graphics,
modify colours etc. you just need to change the template(s) and replace
the ones that came with the original distribution of CuteMarks.
Just be patient - please! - with the placeholders used to display dynamically
generated code from the scripts. The placeholders can be easily determined:
- Either they appear in braces like "{WELCOME}"
- Or they may appear as a complete block which consists of a HTML-comment
as start and mark "<--BEGIN msg_no_cat -->"
You could easily also translate CuteMarks as a whole just by translating
the text in the templates. If you have done this, please drop me a mail
and probably a translated version of the templates. I'd like to include
the templates either in the distribution directly or mark you as contributor
for a translated version (if you like) where other people can request
a version directly.
Using another css-style sheet
Because CuteMarks comes - currently - without any graphics there is
no need to change the templates if you don't plan to translate them. I
strongly recommend to use the css mechanism to change this which is also
natural to the WWW itself, of course.
There're a number of fixed names for various styles you may use. If
you alter the names, ok, you're on your own. Because you have to change
this on the next release again as I surely will not change my css to reflect
you personal changes (and that of several other users too,-))
Anyhow, if you think you'd like to see a css-enhancement (another style
for an additional element) or something is really weird in the current
original stylesheet please drop me a mail or use the SourceForge bug reporting
system.
Currently the following custom style names are used (and can be used
in customised templates without harm as they will be supported in the
future):
- .cm-cat Applied to a category node
- .cm-lnk Applied to a link node
- .cm-welcome Applied to the caption at the head of index.php's
output
- .cm-hint
- .annotate Applied the the number of hits for a link
- .cm-error-msg All error messages (database mainly) are displayed
with this style
|