The new 4.2 box chooser
Sitellite 4.2 now includes a wizard-like app that can be used to select boxes from the various installed apps (see the inc/app folder) and to embed them in page, sidebar, or template contents.
An example would be where you want to syndicate news story headlines from another web site via an RSS feed, in which case you would:
1) Select the box chooser in the appropriate location (note: the box chooser may be unavailable in certain locations, depending on your version of Sitellite).
2) Select the 'News' app.
3) Select the box named 'RSS Viewer'.
4) Enter the RSS link in the text box on the last screen of the box chooser.
When you're done, Sitellite will have automatically inserted the necessary tag to embed the news/rss/viewer box into your location of choice.
Adding a box to the new 4.2 chooser
Once you have a box written, there are three IniFiles that are used to tell the BoxChooser about your box. Note that the paths below are relative to your inc/app/yourappname folder.
1) The conf/config.ini.php file tells Sitellite a little about your app and how it behaves. Add the following line to have it tell Sitellite that your app contains selectable boxes:
boxchooser = on
2) The boxes/yourboxname/access.php file tells Sitellite who can access your box and how it can be accessed. To make a box visible publicly, you need the following lines:
sitellite_access = public
sitellite_status = approved
Additionally, to call your box from the URL via /index/yourappname-yourboxname-action, you need to add the line:
sitellite_action = on
And finally, to call your box embedded in a web page, add the line:
sitellite_inline = on
Access files are inherited into sub-folders as well, beginning with the base boxes folder, except when a new access file is found. Only the closest access file to a box is used -- settings do not inherit from multiple access files.
3) The boxes/yourboxname/settings.php file tells Sitellite about an individual box itself, and how to display it in the box chooser. This file is very similar to the FormSettings files, with the differences being threefold:
- The top block is called [Meta] instead of [Form].
- Widgets are optional. They are used to allow users to enter custom values that will appear in the $parameters hash inside the box logic.
- A submit widget should be omitted, as it is dynamically generated for you by the box chooser.
Here is a sample settings file taken from the news/rss/viewer box:
; <?php /*
[Meta]
name = RSS Viewer
description = View RSS feeds from other web sites.
[newsfeed]
type = text
alt = News Feed
rule 0 = not empty, You must enter a news feed to continue.
[limit]
type = text
alt = Limit
; */ ?>
The first and last line cause PHP to render the file as a blank file should it be requested directly through a browser, which is an added security measure for IniFiles. The [Meta] block contains two settings, name and description.
Settings files are not inherited at all. They are specific to each box in your app.
Revision from August 1, 2007 1:15 PM by lux
Forward in time (1 more) | Back in time (2 more) | See current | See changes | Linked from: Boxes, External Forms