Categories > TinyButStrong general >

Parameter return?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Digital Spaghetti
Date: 2006-08-22
Time: 13:11

Parameter return?

Hi there,

I'm building myself a small, lightweight blog system - nothing too serious, it's just for show.

I've decided to use TBS for my template system, and have hit a small snag.

I'm using AJAX widgets for each block of code in the system, so you can place your items anywhere and I want to.  Each widget has a position and order.  I've tried this so far.

In my template file, I specify each area as such:

[body.widget_name;position=body]

For some reason, I think I don't need the position=, do i?  But I can't seem to find out how to get the template tags name.

now here is my PHP:

<?php

$jBlogTemplate->LoadTemplate('themes/default/index.jtemp');

$jBlogTemplate->MergeField('header,body,footer','display_widgets',true);

function display_widgets($Subname,$position) {
    global $database;
    $result = $database->query("SELECT widget_title FROM jb_widgets WHERE widget_area=" . $position . " ORDER BY widget_order ASC",__FILE__,__LINE__);
    echo $result;
    $widgets = $database->fetch_array($result);
    return $widgets['widget_name'];   
}

$jBlogTemplate->Show();

?>

All I get back from this is a SQL error:

Error Unknown column 'Array' in 'where clause' in query SELECT widget_title FROM jb_widgets WHERE widget_area=Array ORDER BY widget_order ASC. In file C:\Documents and Settings\Alexandria Siemens\My Documents\Tane\xampplite\htdocs\jblog\themes\default\template_default.php in line 9. Date: 2006-08-22 12:03:51
Object id #4Error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Object' at line 1 in query Object id #4. In file in line 0. Date: 2006-08-22 12:03:51

What I need to know is, can I cut out using the position parameter, and some how grab the name directly from the tag.  if not, how do I extract the data from that array to be used in the SQL code?

Thanks
By: Digital Spaghetti
Date: 2006-08-22
Time: 13:47

Re: Parameter return?

I've actually made a change which I think is a lot nicer, but still having problems.

I've activated the Merge On the Fly plugin:

include_once('lib/tbs/tbs_class.php');
$jBlogTemplate = new clsTinyButStrong;
include_once('lib/tbs/plugins/tbs_plugin_mergeonfly.php');
$jBlogTemplate->PlugIn(TBS_ONFLY, 100);

I then, in my template file define each sections content:

$jBlogTemplate->LoadTemplate('themes/default/index.jtemp');

$jBlogTemplate->MergeBlock('header,body,footer','mysql',"SELECT widget_title FROM jb_widgets WHERE widget_area = '%position%' ORDER BY widget_order ASC");

$jBlogTemplate->Show();

The call tag in the template file is still the same.  Now I don't get any errors, but nothing shows up either.  Any ideas?