TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

First test using demo_oo_text.php

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: giovannino
Date: 2013-10-28
Time: 19:06

First test using demo_oo_text.php

Hi ,
I've, in some way.., arrived to test a demo using demo_oo_text.php  but I'm blocked here:

TinyButStrong Error in field [var.x_delete...]: the key 'x_delete' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [var.x_delete...]: the key 'x_delete' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [var.x_delete...]: the key 'x_delete' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [var.x_delete...]: the key 'x_delete' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [onshow.yourname...]: the key 'yourname' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [onshow.yourname...]: the key 'yourname' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [onshow.yourname...]: the key 'yourname' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error in field [onshow.yourname...]: the key 'yourname' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.

TinyButStrong Error Show() Method: The output is cancelled by the OpenTBS plugin because at least one error has occured.

I do not really what to do next.
Thanks
By: Skrol29
Date: 2013-10-28
Time: 23:37

Re: First test using demo_oo_text.php

It seems that you code is calling the example snippet within a fnuction or a method.
Is that correct?
By: Giovannino
Date: 2013-10-29
Time: 07:58

Re: First test using demo_oo_text.php

This is the code of example .  I modified a little bit the include .

// Include classes

//sc_include_lib ("TBS", "TBS Plugin Opentbs" );
define("ROOT_DIR", dirname(__FILE__));

include_once(ROOT_DIR.'\tbs_files\tbs_class.php'); // Load the TinyButStrong template engine
include_once(ROOT_DIR.'\tbs_files\tbs_plugin_opentbs.php'); // Load the OpenTBS plugin

// Initalize the TBS instance
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin

// ------------------------------
// Prepare some data for the demo
// ------------------------------

// Retrieve the user name to display
$yourname = (isset($_POST['yourname'])) ? $_POST['yourname'] : '';
$yourname = trim(''.$yourname);
if ($yourname=='') $yourname = "(no name)";

// A recordset for merging tables
$data = array();
$data[] = array('rank'=> 'A', 'firstname'=>'Sandra' , 'name'=>'Hill'      , 'number'=>'1523d', 'score'=>200, 'email_1'=>'sh@tbs.com',  'email_2'=>'sandra@tbs.com',  'email_3'=>'s.hill@tbs.com');
$data[] = array('rank'=> 'A', 'firstname'=>'Roger'  , 'name'=>'Smith'     , 'number'=>'1234f', 'score'=>800, 'email_1'=>'rs@tbs.com',  'email_2'=>'robert@tbs.com',  'email_3'=>'r.smith@tbs.com' );
$data[] = array('rank'=> 'B', 'firstname'=>'William', 'name'=>'Mac Dowell', 'number'=>'5491y', 'score'=>130, 'email_1'=>'wmc@tbs.com', 'email_2'=>'william@tbs.com', 'email_3'=>'w.m.dowell@tbs.com' );


// Other single data items
$x_num = 3152.456;
$x_pc = 0.2567;
$x_dt = mktime(13,0,0,2,15,2010);
$x_bt = true;
$x_bf = false;
$x_delete = 1;

// -----------------
// Load the templatehttp://127.0.0.1:97/scriptcase/devel/conf/scriptcase/img/top/app_run.png
// -----------------

$template = ROOT_DIR . '\tbs_files\demo_oo_text.odt';
//echo $template;
$TBS->LoadTemplate($template , OPENTBS_ALREADY_UTF8); // Also merge some [onload] automatic fields (depends of the type of document).


// ----------------------
// Debug mode of the demo
// ----------------------
if (isset($_POST['debug']) && ($_POST['debug']=='current')) $TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT, true); // Display the intented XML of the current sub-file, and exit.
if (isset($_POST['debug']) && ($_POST['debug']=='info'))    $TBS->Plugin(OPENTBS_DEBUG_INFO, true); // Display information about the document, and exit.
if (isset($_POST['debug']) && ($_POST['debug']=='show'))    $TBS->Plugin(OPENTBS_DEBUG_XML_SHOW); // Tells TBS to display information when the document is merged. No exit.

// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------

// Merge data in the body of the document
$TBS->MergeBlock('a,b', $data);

// Change chart series
$ChartNameOrNum = 'a nice chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 'Series 2';
$NewValues = array( array('Category A','Category B','Category C','Category D'), array(3, 1.1, 4.0, 3.3) );
$NewLegend = "Updated series 2";
$TBS->PlugIn(OPENTBS_CHART, $ChartNameOrNum, $SeriesNameOrNum, $NewValues, $NewLegend);

// Delete comments
$TBS->PlugIn(OPENTBS_DELETE_COMMENTS);


// -----------------
// Output the result
// -----------------

// Define the name of the output file
$save_as = (isset($_POST['save_as']) && (trim($_POST['save_as'])!=='') && ($_SERVER['SERVER_NAME']=='localhost')) ? trim($_POST['save_as']) : '';
$output_file_name = str_replace('.', '_'.date('Y-m-d').$save_as.'.', $template);
if ($save_as==='') {
    // Output the result as a downloadable file (only streaming, no data saved in the server)
    $TBS->Show(OPENTBS_DOWNLOAD, $output_file_name); // Also merges all [onshow] automatic fields.
} else {
    // Output the result as a file on the server
    $TBS->Show(OPENTBS_FILE+TBS_EXIT, $output_file_name); // Also merges all [onshow] automatic fields.
}

By: Niek
Date: 2013-11-09
Time: 22:20

Re: First test using demo_oo_text.php

Hi,
I am getting the same errors with the demo_ms_wordt.php example provided.

Any luck yet?