Sf-Active Smarty How TO

Setup

  • Install the current cvs, and set it up like you would always do.
  • You'll need two vhosts, one for publishing, and one for static stuff. The publish one will point to sitename/website, and the static one will point to /sitename/static.
  • For now, turn on directory indexing so that the static site will look like something
  • you'll need 3 parts in your include path:
    • the normal include path (to the install path)
    • to where smarty is installed
    • to your site install (to /path/to/sf-active/sitename/). without this last one, includes will fail
  • You'll need the static versions of the include files in sitename/local/include/(lang)/: you can generate them for an initial install by running sitename/scripts/cli_all_includes.php (make sure that the directory paths inside are correct)
  • You can also regenerate the static include files by going to Administration | Regenerate Cache - All Includes (run rule)
  • re-cache the feature index pages by clicking on Customize | Categories | (any category) - check here if you want to recache this category index, and then save
  • Symlink in /website/im, /website/images, /website/themes, /website/scripts to /static (this step should be eliminated eventually)
  • run the following rule in the Administration | Regenerate Cache | Producer Rules section: static page with the argument "index.tpl"
  • in Administration | Refresh cached files go to the subsections and Cache most of the stuff.
    • Articles
    • Features
    • Calendar

  • Temporarily comment out the line in sfactive.cfg that include the build_sites.inc file (near end of file) -- because the build_sites.inc file might not yet exist
  • Log into the admin and edit the languages. set at least the languages you'll use. be sure to set 'build site' for the languages you want to work with.
  • Turn back on the the build_sites.inc include line

Main functionality.

  • the pages in shared/classes/pages/ all work with the following stuff:
    • the translation is done automatically from out of the Page class. page will set $this->tr->create_translate_table($page_id) before it will setup the new page ($this-$page = new Page ; $this->$page-tr = $this-tr ; $this->$page->execute. this is how it was meant to be, but it seemed broken.
      • the page class will assign $globals dict to a 'dict' in smarty so you can acceess the strings with {$dict.}.
    • whatever you assign to $this->tkeys will be assigned under the 'tkeys' array in smarty (use {$tkeys.}
  • don't format dates. just keep them as a unix timestamp, a mysql-timestamp or whatever that parsable to strftime. you can use 'date_format' modifier of smarty to format them (this will also display internationalised dates).
  • there's a class with smarty functions/modifiers. see: http://sfa.indymedia.org/docs/tech/cvs/sf-active/template/SmartyFunctions.html

-- PseudoPunk - 26 Dec 2004
Topic revision: r6 - 12 Jul 2005, PseudoPunk
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback