> From: Clifton Wood <cl...@sl...>...
>
> > First, I can only seem to access the menu entries in the menus...
>
> No, this is in the API, you can either do it through Perl:
>
> perl -MSlash::Test=virtualuser -le \
> 'print Dumper($slashdb->getMenuItems(<menuname>))'
...
> [% menus = Slash.db.getMenuItems("admin") %]
>
I'm sorry, I wasn't clear. I can't see any way to *edit* the menu
items from within the admin interface. Of course I can fetch the data
programmatically as you suggest, but I can't change the entries from
within a running slash site. I have to either write a sql script or
run mysql console.
> > Second, the menus table could use another hook ...
> Another (and non-normalized) way to do this would be to
> create another table:
...
> [and access it] via template:
>
> [%
> styleinfo = Slash.db.sqlSelect(
> 'styleid, stylecss',
> 'menu_styles',
> 'id=' . Slash.db.sqlQuote(menu_id)
> );
> %]
>
> This gives you the advantage of compatibility with the Slash
> libraries, and flexibility to add whatever you need to
> the menu_styles table, at the expense of maintaining your
Good idea, thanks. I have been trying to stick with "stock" slashcode
calls for generating headers and footers of a page, modifying only the
template. This looks like a decent recipe for fetching the style data
from within a modified template.
>
> > Third, [static vs dynamic css style sheet]
> > [ ... ]
>
> You don't mention what types of style sheets need the dynamic
> treatment, nor where you are generating them in the overall scheme
> of Slash.
...
> If you have a specific set of CSS styles that need to be regenerated
> over the course of the day, you could make a task to update these
> dynamically (the file is served static, but dynamically generated
> ever <x> minutes or <y> hours).
Right I forgot about that capability. This would work well for stuff
like inserting menu items---the new menu items need their own id tags
to be defined in the stylesheet. That changes slowly, and can be
handled with a periodic (daily or slower) job.
Other CSS dynamicism (?) I can think of mirrors Slash's ability to set
colors, etc. For example, the following snippet from header;misc;default
<BODY BGCOLOR="[% user.bg.0 %]"
TEXT="[% user.fg.1 %]"
LINK="[% user.bg.3 %]"
VLINK="[% user.fg.1 %]">
could also be accomplished with a markup CSS "file" which is generated
in the header template, something like (not having tested it):
.user_scheme0 {
background-color: [% user.bg.0 %];
color: [% user.fg.1 %];
}
.user_scheme0 a:link {
color: [% user.bg.3 %];
}
.user_scheme0 a:visited {
color: [% user.fg.1 %];
}
.user_scheme0 a:hover {
color: [% user.fg.1 %];
}
.user_scheme1 {
...
}
then the tag markup becomes, for example,
<BODY class='user_scheme0' id='[% selected_menu_item %]'>
I'll continue to hack on this over the holidays, and post at a later
date what I end up doing in practice.
cheers,
James
ps. I don't want to bore anyone with my litany of projects using
slashcode. If anything ever gets stable and useful, I'll publish them
somehow. But right now I'm more or less driving nails with an iPod.
|