Objects

The default TinX/cms is packed with standard objects for website creation. In time, we hope that you will help us develope some new objects for TinX/cms - it is pretty simple.


TinX/cms includes the following objects:


  • Text: Using the FCK Editor (www.fckeditor.net) as the online editor, gives this object a rather unique advantage over many other editors. It contains a file manager for uploading images, flash, etc.
  • Contact form: A simple form with a simple configuration, yet powerfull.
  • File include: If you have a local or remote file you want to include "as-is", this object is usefull.
  • mage: for adding an image in a grid
  • Sitemap: Shows a list of all documents available on the website in an unsorted list.
  •  Search result: Displays the results of what you searched for.
  • Embedded content: Displays an external page in either an IFRAME or as the embedded content.
  • Screenshot gallery: Simple and easy to configure.
  • RSS feeds: Display RSS feeds where you want to on your website
  • Catalog: Small catalog. You create a catalog and add items with images and thumbnail creation  - images are stored in a table and thumbnails are created on-the-fly
  • Document list: This object displays a selected category of pages. The list of pages can also be converted into an RSS feed, for others to use.
  • Gallery: With this object you can upload images, displays thumbnails of the images and open the images using Fancybox
  • Attachments: add this object to your document if you want files to be attachment to the document and displayed in link form for you to stye
  • Flash music player: The object makes it easy to add sound clips to your document
  • Movie: Adds a movie clip to the document
  • Video: Open flash movies (fx youtube videos) in a cool looking Fancybox window.
  • Slideshow: This document adds a slideshow of images to the document using JQuery Cycle Plugin

Create your own objects

If you need to create your own objects, you can do so and it is pretty easy.

All objects must be in the /admin/objects/ folder and named correctly. Lets say you want to create an object for listing related content on a document. Do the following:

   1. Create a folder /admin/objects/RelatedContent
   2. Create a file in the folder with the same name as the foldername:
      /admin/objects/RelatedContent/RelatedContent.php
   3. Add the object to the Object list in TinX/cms administration (see image below)
   4. Create a table in the database: object_relatedcontents that contains the fields for your object

Now you are ready to create your object class. The class must extend TObject. Below is a small example of an object.

// defines: small example of how to to create an object

if(!defined("CLASS_TSourceCodeObject")) {  // Unique name
define("CLASS_TSourceCodeObject",TRUE); 
define("TSOURCECODE_VERSION", "1.0");
define("TSOURCECODE_MODIFIED", "03-12-2008 - 17:27:52");

// Language settings for labels
$object_language["da"]["labels"]["description"]		= "Beskrivelse";
$object_language["en"]["labels"]["description"]		= "Description";

/************************************************************************************
	The class SourceCode object from the database
************************************************************************************/
class TSourceCodeObject extends TObject {

	function TSourceCodeObject($s,$t="tinx_object_sourcecodes",$row=NULL,$loadMe=true){
		parent::TObject($s,$t,$row,$loadMe); // Call parent constructor

		// Set field names from table i mysql i array
		$this->objectFieldNames[0] = "id";	
		$this->objectFieldNames[1] = "title";	
		$this->objectFieldNames[2] = "srctype";	
		$this->objectFieldNames[3] = "src";	
	}
	
	function getSourceType()	{ return $this->objectFieldValues[2]; }
	function getSourceCode()	{ return $this->objectFieldValues[3]; }
	function getFormattedCode(){
		$retur .= "
getSourceType()."\">\n";
		$retur .= $this->getSourceCode();
		$retur .= "
\n"; return $retur; } } /* End class */ } /* End define */

// Test if this is the object to save
$isJustSaved = false;
$editObject = false;
if($_SERVER["REQUEST_METHOD"]== "POST" && $POST_OBJECTACTION === "save" && 
$POST_DOCFIELDSID == $ROW_ID && $GET_OBJECT == $ROW_OBJECTID &&
 isset($_POST["postsave"])){ // Make sure we get it right 

	// "false" = don't load object from table
	$objectPtr = new TSourceCodeObject($sqlPtr,$tables["object_sourcecodes"],$row,false);

	$arr[0] = $ROW_OBJECTID;
	$arr[1] = $_POST["objecttitle"];
	$arr[2] = $_POST["srctype"];
	$arr[3] = $_POST["src"];
	
	$objectPtr->createObject($arr);
	$objectPtr->saveObject($row['docid']);
	$isJustSaved = true;
	unset($_POST);
}else{
	$objectPtr = new TSourceCodeObject($sqlPtr,$tables["object_sourcecodes"],$row);
}

if($GET_OBJECT == $objectPtr->getID() && $GET_OBJ == $ROW_ID && !$isJustSaved)	{
	$editObject = true; 
}

if(!$editObject){
	echo "
0?"_islinked":"")."\">\n"; include('admin/objects/object_actionbuttons.php'); if($isJustSaved ){ echo "".$help["object_updated"]."
\n"; } if($GET_OBJECT != "" && $GET_OBJECT != $objectPtr->getID()){ echo "".$objectPtr->getTitle().""; }else{ // Get the container and replace som tags $lines = replaceSubstring($containers[$row[7]],"[HEADING]",$objectPtr->getTitle()); echo replaceSubstring($lines,"[CONTENT]",$objectPtr->getFormattedCode()); } echo "

\n"; }else{ $ctrl_id = $ROW_ID . $ROW_OBJECTID; /* .... Put the form here to create maintain the object... */ }

This is an example of a form for maintaining the SourceCode object


	





 

This page load time was 0.025 seconds
Designed by TinX/dk - www.tinx.dk
Design by TinX/dk