ThemesAnatomy

From SoylentNews
Jump to navigation Jump to search

SlashDocumentationIndex - parent of this page


Notes

There are currently three themes in slash/themes:

slashcode - seems to be primary theme used.
slashcode.com   - the slashcode.css used seems to be here. Also ostnavbar.css see below.
useperl -  This is the theme for a real site, useperl.com

Apparently these are mixed in use, as the links in site/slashcode.local/htdocs point to different places:

 admin.css -> /usr/local/slash/themes/slashcode/htdocs/admin.css
 base.css -> /usr/local/slash/themes/slashcode/htdocs/base.css
 comments.css -> /usr/local/slash/themes/slashcode/htdocs/comments.css
 handheld.css -> /usr/local/slash/themes/slashcode/htdocs/handheld.css
 ostgnavbar.css -> /usr/local/slash/themes/slashcode.com/htdocs/ostgnavbar.css
 print.css -> /usr/local/slash/themes/slashcode/htdocs/print.css
 slashcode.css -> /usr/local/slash/themes/slashcode.com/htdocs/slashcode.css
 slashcode_lite.css -> /usr/local/slash/themes/slashcode/htdocs/slashcode_lite.css
 slashcode_low_bw.css -> /usr/local/slash/themes/slashcode/htdocs/slashcode_low_bw.css

It appears you cannot just switch from one theme to another live, they must be installed in some way. When first setting up the site, you run slash/bin/install-slashsite script which lists the skins and asks you which one you want to use. There is a script in slash/bin to just install a new theme.



Contents of slashcode theme

slashcode/
 THEME - seems to be a list of ll the parts of this theme
 htdocs/ - softlinks in site/slashcode.local/htdocs point to real files here.
   404.pl        badge.pl         images            robots.txt             topics.pl
   about.shtml   base.css         imgupload.pl      shtml.pl               users.pl
   admin.cssraw  comments.cssraw  index.pl          slashcode.cssraw       users2.pl
   article.pl    comments.pl      moderation.shtml  slashcode_lite.cssraw
   authors.pl    handheld.cssraw  ok.txt            slashcode_low_bw.css
   badge.js      help.pl          print.css         slashguide.shtml
 misc/
   spamarmors - regex code or sed code to add NOSPAM etc to email addresses
 sql/
   postgresql - not usable, but must exist.
   mysql
     prep.sql 
       # $Id$
       UPDATE stories SET time = DATE_ADD(NOW(), INTERVAL -2 DAY) WHERE sid = '00/01/25/1430236';
       UPDATE stories SET time = DATE_ADD(NOW(), INTERVAL -1 DAY) WHERE sid = '00/01/25/1236215';
       UPDATE discussions SET flags = 'hitparade_dirty';
     datadump.sql - appears to be the sql table iitialization used at install time for this theme
       Contains stuff like:
         # Dumping data for table 'comment_text'
         INSERT INTO comment_text (cid, comment) VALUES (1, 'This is the first post put into your newly
         installed Slash System.  There will be many more.
 tasks/ - this appears to be all the stuff run by slashd periodically 
   accesslog_artcom.pl
   balance_readers.pl
   counthits.pl
   daily.pl
   daily_archive.pl
   daily_forget.pl
   dbsparklines.pl
   delete_accesslog.pl
   expire.pl
   flush_formkeys.pl
   freshenup.pl
   html_update.pl
   im_messages.pl
   ircslash.pl
   log_db_qps.pl
   new_headfoot.pl ( skinHeaders )
      -This seems to be the only file in this section that references css-
      - appears to be what actually updates the header and footer '.inc' files -
      - in slash/site/slashcode.local/htdocs/slashcssbase.inc which has all the css includes -
      -interesting lines -
      my $skins = $slashdb->getSkins;
      my $file = "$constants->{basedir}/slashhead-gen-full.inc";
      $file = "$constants->{basedir}/slashcssbase.inc";
      my $cssbase = slashDisplay("html-header", { only_css => 1}, { Return => 1 });
      sub skinHeaders {
      # What to do here if !$skin?  Does that mean to use $gSkin?
      # Or return without doing anything?  An empty string passed to
      # getHeadFootPages() means to use the template skin 'default'.
      # Apparently, for years, we've been passing open() a filename
      # like /u/l/s/s/foo/htdocs//slashhead.inc and it's been
      # quietly fixing the double-slash for us.  If I'm correct in
      # understanding how this has been working, we want to start
      # using File::Path to construct $file below. - Jamie 2005/11/2
      print $fh $cssbase;
      setCurrentForm('ssi', 0);  
        -what is ssi referring to? Apache server side includes or something perl is doing?-
        - It is being turnrd off an on in this routine.-
      $file = "$constants->{basedir}/$skinname/slashfoot.inc";
      open my $fh, ">$file" or die "Can't open $file : $!";
      my $footer = footer({ Return => 1, Page=> $_->[0] });
      print $fh $footer; - so is 'print' what normally outputs the html etc. to ther user?-
                          - I wonder what file handle is used for that.-
                          - in this case it appears to be outputting to the files, updating them-
      close $fh; 
   new_motd.pl
   open_backend.pl
   p2f_hof_topics.pl
   performance_stats.pl
   precache_gse.pl
   process_file_queue.pl
   refresh_authors_cache.pl
   refresh_section_metakeywords.pl
   report_slashd_errors.pl
   rotate_semirandom_block.pl
   rss_submit.pl
   run_moderatord.pl
   run_portald.pl
   set_cids.pl
   set_gse_min_stoid.pl
   set_recent_topics.pl
   spamarmor.pl
   url_checker.pl
 templates/ - "A template is a bit of text that is parsed by Perl, using the Template
Toolkit." See TemplateAnatomy for details on how this works

Official docs for themes from docs/HOWTO-Themes.pod

HOWTO-Themes - How to write and use Slash themes

=head1 QUESTIONS

=head2 What is a theme?

A theme is a website design. It can have some functionality
to it (for example, the slashcode theme is a weblog). Functionality,
though, is normally split into seperate plugins.

=head2 How do I get my theme into the install system?

There are two ways to do this. First, you can put it in the
themes directory with the distribution. During the install it
will be copied to the themes directory (by default,
F</usr/local/slash/themes/>. The second option is to copy it in there
yourself. The directory layout is very important with themes.
The install expects to find a sql directory with a mysql and postgresql
directory in it. It expects a templates directory with templates in it and
finally it expects an htdocs directory. It copies files 
directly from htdocs to the install's directory.
Look at the slashcode theme as an example.

=head2 What does my theme need to make it work with the install?

Just the directory structure explained above. Right now there
is no THEME file like there is a PLUGIN file for PLUGINS.
Expect this to change at some point in the future.

=head2 I have a really cool theme and I would like to see it added to the Slash
distribution. Will you distributed mine?

Maybe. We don't have any rules concerning this at the moment, so it will be
on a case by case basis. At some point in the future we will come up
with a much better answer.