Hi,
recently I have been playing a bit with the RazorCMS code
(see BACKGROUND below), and I have one question:
- when creating pages that involve images, I have not found a good
way to store them and display them in the editor.
For the first part, i made a one-line change to function findPageFile()
(and similar one on the page creation routine, put2file) so that
each page is created in its own directory datastore/pages/NNNN/
which can contain the file, N.txt, and possibly images or other
related content.
Irrespective of the above change, there is the problem that the
editor (i tried tinyMCE but possibly others have the same problem)
runs with http://..../yoursite/admin/ as base URL,
whereas pages are displayed with a base of http://..../yoursite/
and so there is no good way to use relative URLs for images and
other inline objects.
My take would be to create the text files with plain relative urls
or perhaps some recognisable marker ./ in front of them (e.g. <img
src="./img1.jpg"> ) and then have loadSlabContents() replace the
'./' with 'datastore/pages/NNNN' (this is straightforward).
On the editor side, however, I would need a similar rewrite, and
I am not sure on which option to follow:
a) try to run the editor within an IFRAME and a base of
http://..../yoursite/datastore/pages/NNNN/
b) tweak the editor (the javascript code) so that it does some URL
rewriting when you enter a relative URL for an image, so that
it automatically adds the datastore/pages/NNNN part if not there
yet;
Perhaps there are other ways. Any ideas ?
BACKGROUND
In my search for db-less CMS, i found RazorCMS and i quite liked
certain design choices (very small footprint, modularity, zip-based
installs) so i started trying it and see how it suited my purposes
(a few CMS for my own research pages and departments i am affiliated
with).
In the past few weeks i have been doing a significant amount of code
restructuring on your RazorCMS code, especially on the admin side,
with the intent of removing some code duplication and figure out
its features and limitations.
You can find a snapshot of what I have so far at
http://info.iet.unipi.it/~luigi/doc/razor20100621.tgz
you may or may not like them.
The changes include all of your 1.1-stable bugfixes, and more
(e.g. the 'random' support is now present on all file manipulation
functions). I have also added a number of small features, such as
- create file (and fixes for editing empty files);
- upload directly from a remote URL;
- ability to customize on a per-page basis three menus;
- much more compact admin menus (it was painful to work with them
on a small laptop with 768 rows)
One thing you might notice is that i have replaced inline
section of html with function-generated ones e.g. _t('li', ...)
creates a <li>...</li> block and so on. This makes it a lot
easier to figure out the logical structure of a block, as well
as move objects around in the page.
If you are interested in further changes let me know, and I will
gladly keep you posted.
cheers
luigi