By: robee
Date: 2003-08-19
Time: 12:30
|
file inclusion
also...i've got problems regarding your file inclusion...I've created a query page...
ManageSerials.htm
<html>
<head>
<title>Serial Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/spec.css" rel="stylesheet" type="text/css">
</head>
<body>
<p align="left" class="titlePage">[MainTitle]</p>
<form action="[sys.script_name]" method="post" name="frm_search">
<table width="50%" class="tblOutHead">
<tr class="tblOutHead">
<td class="fontHead">Search for Serials</td>
</tr>
<tr class="tblOutBody">
<td><br>
<table width="50%" class="tblBodyIn" cellpadding="0" cellspacing="0" align="center">
<tr class="tblBodyIn" bgcolor="#f0f0f0">
<td> </td>
</tr>
<tr class="tblBodyIn">
<td>
<table width="100%" border="0">
<tr>
<td colspan="2"><input type="radio" name="radSearch" value="Search" [var.radSearch;if [val]=Search;then checked]>
<font class="radioTitle">Search</font></td>
</tr>
<tr>
<td width="7%"> </td>
<td width="93%">
<input name="queryString" type="text" value="[var.queryString]">
<select name="selectField" size="1">
<option value="[fieldblk.key]">[fieldblk.val;block=option]</option>
<option>[var.selectField;selected]</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><input name="radSearch" type="radio" value="All" [var.radSearch;if [val]=All;then checked]>
<font class="radioTitle">Show all</font></td>
</tr>
<tr>
<td colspan="2" class="fontForm">Sort by:
<select name="selectSortField" size="1">
<option value="[sortblk.key]">[sortblk.val;block=option]</option>
<option>[var.selectSortField;selected]</option>
</select>
</td></tr>
<tr>
<td colspan="2" class="fontForm">Order by:
<select name="selectOrder" size="1">
<option value="[orderblk.key]">[orderblk.val;block=option]</option>
<option>[var.selectOrder;selected]</option>
</select>
<input type="submit" name="Submit" value="Go" class="submitGo"></td>
</tr>
<tr>
<td colspan="2"><div align="right"><a href="Report.php">Print
Report</a></div></td>
</tr>
</table></td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</form><br>
<table width="100%" border="1">
<tr>
<td>[tbs_include.onload;file=[var.f_html];htmlconv=no]</td>
</tr>
</table>
</body>
</html>
|
and the code that calls it:
<?
include_once("../lib/tbs_class.php") ;
include_once("../lib/inc/common.inc.php");
include_once("../lib/GetData.class.php");
include_once("../lib/elements/QueryBuilder/QueryBuilder.class.php");
$Submit == "Go";
$TBS = new clsTinyButStrong ;
$f_html = 'PagingSerials.php' ;
$TBS->LoadTemplate("../lib/layouts/ManageSerials.htm") ;
$TBS->MergeBlock("fieldblk",$SEARCH_FIELD) ;
$TBS->MergeBlock("sortblk",$SORT_FIELD) ;
$TBS->MergeBlock("orderblk",$ORDER_BY) ;
$TBS->MergeField("MainTitle","Serials Management") ;
$ret = new Retrieve();
$ret->m_Prm_Retrieve('Submit,radSearch,radAll,queryString,selectSortField,selectOrder','') ;
if ($Submit == "Go"){
$query = new QueryBuilder();
$tbl1 = "tblHoldings"; //table 1 name
$tbl2 = "tblHoldingsCopy"; //table 2 name
$tbl1_fields = array(HoldingsID,Title,ISSN); //fields for table 1
$tbl2_fields = "CallNum"; //fields for table 2
$fKey = "HoldingsID"; //look-up field
$sqlStatus = "And $sqlTbl.Status != 'In'";
$str_query = $query->selectQuery($sqlStatus,$agency,$tbl1_fields, $tbl2_fields, $tbl1, $tbl2, $fKey, $Submit,
$radSearch, $selectField, $selectSortField, $selectOrder,$queryString);
$TBS->Show() ;
}
?>
|
now..I want to include my 'PagingSerials.php' where i declared on my $f_html = 'PagingSerials.php'...this script contains this code:
<?
include_once("../samples/tbs_class.php") ;
//Connexion to the database
require('../samples/DB.php');
function m_getlinks($PageNum, $width, $page_nbr = 0)
{
$links = array();
$page_min = $PageNum - ($PageNum % $width) + 1 ;
$page_max = $page_min + $width - 1 ;
if($page_nbr > 0)
$page_max = min($page_max, $page_nbr);
if($page_min > 1)
$links[$page_min-5] = ' << ';
for($i = $page_min; $i <= $page_max; $i++)
$links[$i] = $i;
if($page_nbr > $page_max)
$links[$page_max+1] = ' >> ';
return $links;
}
//The file DB.php contains the following lines :
// $cnx_id = mysql_connect('localhost','user','password') ;
// mysql_select_db('dbname',$cnx_id) ;
//$TBS = new clsTinyButStrong ;
//$TBS->LoadTemplate("datasql.htm") ;
//$recset = $TBS->MergeBlock("blk",$cnx_id,"SELECT * FROM tblHoldings where AgencyCode='SEI'","",$PageSize,$PageNum,$RecCnt);
//Default value
if (array_key_exists("PageNum",$_GET)) {
$PageNum = $_GET["PageNum"] ;
} else {
$PageNum = 1 ;
} ;
//Default value
if (array_key_exists("RecCnt",$_GET)) {
$RecCnt = intval($_GET["RecCnt"]) ;
} else {
$RecCnt = -1 ;
} ;
$PageSize = 20 ;
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate("../lib/layouts/PagingSerials.htm") ;
//Merge the block by page
$RecCnt = $TBS->MergeBlock("blk",$cnx_id,"SELECT * FROM tblHoldings where AgencyCode='SEI'",$PageSize,$PageNum,$RecCnt) ;
//Calculate the number of page
$PageCnt = ceil($RecCnt / $PageSize) ;
//Display the list of pages
$TBS->MergeBlock("pg","num",$PageCnt) ;
$links = m_getlinks($PageNum,10,$page_nbr) ;
$TBS->MergeBlock("nav",$links) ;
$TBS->Show() ;
mysql_close($cnx_id) ;
$TBS->Show() ;
?>
|
as u see, it calls the PagingSerials.htm...when I try to execute ManageSerials.php (where I called my PagingSerials.php), it didnt processed the php script..it returns me the code syntaxes..how can I include another script with values coming from the main script and display it on one page?..I find TBS a helpful engine in doing my library system software...but i'm still not familiar with all the syntaxes..i hope you can help me with all my questions..thanks!
|
By: Skrol29
Date: 2003-08-20
Time: 01:47
|
Re: file inclusion
Hello Robee,
This is the same problme as Aaron Mueller.
To execute a script instead of including the content of a file, you must use the patameter 'script=...' instead of 'file=...'.
If you want this script to return a result which insterted in the main template, then use the 'getob' parameter.
A last recommandation : in you sub-script, use another variable name for the TBS object (for example $TBS2) or PHP will use the same varibale for the two scripts. And set the render propety to TBS_OUTPUT is the sub-script. If not, the total script will exit by default just after $TBS2->Show().
|