Barnyard BBS
…enemies becoming friends,
…when bitterness ends
Content Control (PHP Version)
Download
Download Source and Example Project Here
Background
I originally created the Content Control as alternative to a traditional CMS system.
I wanted the editing capability of a CMS for some of my end-users and friends, but
I didn't want the overhead or commitment. May of the sites that I create do
things, and aren't just static content. A CMS system often is the
site. I wanted to retain creative control over the site's construction, but
provide flexibility.
It doesn't need a database. It just uses the file system. Simple. Tasty.
I've tested it with Firefox, IE 6, and IE 7. If I can be of help in your endeavors,
my website is http://www.barnyardbbs.com.
Specifications (PHP Version)
The Content Control is used by inserting a function call into your page. It was written using PHP5. It generates clean code using TinyMCE.
It appears as the literal content when in viewing mode (your site
doesn't look like a CMS). It renders
as a TinyMCE enhanced textarea in editing mode.
Usage
It's a PHP function call. Remember to include the supporting file. For example:
<?php include('include/ContentControl.php'); ?>
<html>
<body>
<h1>Your Text Here</h1>
<?php ContentControl('OwnerName', 'MainContent', 80, 30); ?>
</body>
</html>
It takes four parameters:
- Owner: This parameter defines which users are allowed to edit the content. It's can be a single name, a space-delimited list of names, or a special keyword. Two special keywords are defined. 'Any' allows any logged-in user to edit the content. 'Anonymous' allows anybody (logged in or not) to edit the content.
- File Name: This filename is used to
differentiate between multiple objects on the same page. The
filename will be appended to the parent's page name. For
example, the content will be stored in the file "index.php.MainContent"
in this example.
- Edit Mode Columns: Specified how many columns
should be used in editing mode. This is helpful when you have
oddly shaped areas in your design (such as a thin news column).
- Edit Mode Rows: Specified how many rows should
be used in editing mode.
Also, there are settings you can configure within the include file:
- SESSION_USER defines the session variable that represents your
user's name. You can change this to integrate with your
existing security.
- NO_CONTENT defines what will be shown when no content exists
yet.
- TINY_MCE_PATH defines the path to TinyMCE from the root of your
site. If you don't see TinyMCE during edit mode, this is
likely incorrect.
- TINY_MCE_CONTENT_CSS defines a stylesheet to be used during edit
mode. This will allow TinyMCE to learn classes and show the
content in a realistic way.
- TINY_MCE_DEFAULT_COLUMNS & ROWS define a default size for all
your controls.
- IMAGE_PATH defines the path to your images folder (that you want users access while editing).
- USER_FILES_PATH defines the path where you want to store your user files (uploaded images and files)
- LOGOUT_PATH defines the script to call when you click the logout button. You can change this if you're integrating into an existing authentication system on your site.
- USERS defines a simple list of users and passwords. Although you can easily use a different method for user storage (like a database), this will give you a simple method to get up and running with the demo package.
Don't forget: TinyMCE has a ton of configuration options. This project uses TinyMCE in a pretty limited manner. You can customize it quite a bit. Visit tinymce.moxiecode.com for details.
Dependencies
- It depends on TinyMCE / TinyFCK (a package of TinyMCE and some components from FCKEditor) for the actual Javascript editing interface. This is
located in the "include/tiny_mce" directory.
- It needs write permissions wherever you choose to store the content files.
Licensing
Creative Commons Attribution 3.0, No restrictions. Share and Enjoy.
I require nothing, but would really appreciate it if you let me know you use it.
It's nice to know your work is useful to somebody.