|
||||||||||||||||||||||
<?php
/*
// =================================================================
// Copyright (C) DTLink, LLC., All Rights Reserved.
//
// Unless explicitly acquired and licensed from Licensor under the
// DTLink Commercial Software License ("DCL") Version 1.0 or greater, the
// contents of this file are subject to the Reciprocal Public License
// ("RPL") Version 1.1, or subsequent versions as allowed by the RPL,
// and You may not copy or use this file in either source code or
// executable form, except in compliance with the terms and conditions
// of the RPL.
//
// You may obtain a copy of both the DCL and the RPL (the "Licenses")
// from DTLink, LLC. at http://www.formvista.com.
//
// All software distributed under the Licenses is provided strictly on
// an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
// IMPLIED, AND TECHNICAL PURSUIT INC. HEREBY DISCLAIMS ALL SUCH
// WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT,
// OR NON-INFRINGEMENT. See the Licenses for specific language
// governing rights and limitations under the Licenses.
// ===================================================================
*/
/**
* A very simple example of hosting a formVista component in a PHP webpage.
*
* This page demonstrates:
* - loading formVista.
* - loading the "article_titles" formVista columnlist component
* - inducing the loaded components to GetData.
* - telling any components to output their CSS files, if any.
* - rendering the component to the browser.
*
* This does not show how to hook up javascript handlers, any of the dynamic menu or
* htmleditor event and does not show how commands are processed. It really is just
* the absolute minimum to get the columnlist component to work. Having said that,
* all these other events are as simple to add as the ones on this page.
*
* COMMENTS:
*
* @package demoshell
* @subpackage trivial
* @author Yermo Lamers
* @copyright DTLink, LLC 2005
* @see article_list.fvml
*/
/**
*
*/
// REVISION HISTORY:
//
// 2005-09-12 YmL:
// . initial revision.
/*
* has configure been run?
*/
if ( ! file_exists( "./config.php" ) )
{
include_once( "./configure_error.php" );
}
// ----------------------------------------------------------------------
// the config.php file is generated by the formVista Configure script. It
// loads in the configuration, connects to the backend data source (usually
// Mysql) and then starts up formVista.
include_once( "./config.php" );
// load the "article_titles" component. Link it back to this page (for NEXT and PREV
// buttons.)
vistaLoad( "/fvml/article_titles", "index.php" );
// tell any components that need to get data from a data source that now is the
// time to do so. This causes the <onGetData ...> section to be run. (This is equivalent
// to vistaEvent( "GetData" );
vistaGetData();
// Page Content goes after here. Stylesheets needed by any components are brought in
// when the CSSIncludes event is raised. The component is rendered to the browser by
// vistaShow().
?>
<html>
<head>
<?php vistaEvent( "CSSIncludes" ); ?>
<body>
<br>
<div class="contentText">
A trivial example. See below for the PHP source of the hosting page along with
the FVML source of the component.<br>
The box below is the article_titles component:
</div>
<br>
<?php vistaShow( "article_titles" ); ?>
<br>
<a href="../../index.php">BACK</a>
<!-- the page actually ends here. the rest is just to expose the source -->
<br>
<br>
<hr>
<h2>PHP Source file for this page</h2>
<?php
// show the source to this page for purposes of example
highlight_file( "./index.php" );
?>
<hr>
<h2>FVML Source file for the article_titles component</h2>
<?php
// show the source of the component
highlight_file( "fvml/article_titles.fvml.php" );
?>
</body>
</HTML>
<?php // exit(0); ?>
<!--
<?php
/**
* Columnlist of Categorized Blog article titles.
*
* This formVista component creates a paged list of "CLOG" article titles.
* It is intended to be an extremely simple example.
*
* @package demoshell
* @subpackage trivial
* @author Yermo Lamers
* @copyright DTLink, LLC 2004
* @see index.php
* @see article_titles_with_comments.fvml
*/
?>
See the other file for comments. This is the bare bones stripped out version so you
can see what FVML looks like.
REVISION HISTORY:
2005-09-12 YmL:
. initial revision.
-->
<component type="columnlist"
name="article_titles"
rowsperpage="10"
defaultlook="flattabsimple_columnlist_">
<!-- ================================================================= -->
<onGetData>
<mysql type="datafeed">
SELECT *
FROM clog_entries
ORDER BY entry_date
$MY{LIMIT}
</mysql>
</onGetData>
<!-- ================================================================== -->
<body template="withtitle" title="Article Titles">
<textrow>
This is an example of a columnlist component. If there
are more than 10 rows it will automatically create the NEXT and/or
PREV buttons and take care of all of the pagination for you.
</textrow>
<foreach>
<col template="row1,row2" headertemplate="header" name="Date">${entry_date}</col>
<col template="row1,row2" headertemplate="header" name="Title">${content_title}</col>
</foreach>
</body>
</component>