I am using the version of xtemplate that is available at phpxtemplate.org. I am in the middle of writing my senior project to get my bachelors degree in CIS. One of my scripts uses xtemplate to call forms that are used to insert information into a database so that another script can call the html template page and populate the html page. I am wondering if this version of x template works with php4. I have an oriely book called web database applications first edition which recommends it.
When I ran the script I got the following errors in the browser.
Warning: Unable to access /xtemplate/xtemplate.class.php in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 2
Warning: Failed opening '/xtemplate/xtemplate.class.php' for inclusion (include_path='.:/usr/share/pear') in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 2
Warning: Unable to access /include/db.inc in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 3
Warning: Failed opening '/include/db.inc' for inclusion (include_path='.:/usr/share/pear') in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 3
Warning: Unable to access /include/error.inc in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 4
Warning: Failed opening '/include/error.inc' for inclusion (include_path='.:/usr/share/pear') in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 4
Fatal error: Call to undefined function: clean() in /home/httpd/vhosts/turquoisepueblo.com/httpdocs/eControl/displayPageForms.php on line 6
Here is my code.
<?php
include_once ("/xtemplate/xtemplate.class.php");
include "/include/db.inc";
include "/include/error.inc";
// $pageId = clean($pageId, 5);
// Has a pageID been provided?
// If so, retrieve the page details for editing
If (!empty($pageId))
{
If (!($connection = @ mysql_pconnect($hostName,
$userName,
$password)))
die("Could not connect to the database");
If (!mysql_select_db($databaseName, $connection))
showerror();
// Find out what page needs to be loaded from the database
// Run the select query to get the information
If ($pageId == 100)
{
// Create a new XTemplate
$xtpl = new XTemplate ("templates/pgHomeForm.htm");
// Run the query
$query = "SELECT hmHeading,
hmSubHeading,
hmPicture1,
hmPicture2,
hmParagraph1,
hmParagraph2,
hmParagraph3,
hmParagraph4,
FROM pgHome
WHERE pageId = $pageId";
}
elseif ($pageId == 101)
{
// Create a new XTemplate
$xtpl = new XTemplate ("templates/pgContactForm.htm");
// Run the query
$query = "SELECT conheading,
conStorename,
conAddress,
conCity,
conState,
conzip,
conphone,
confax,
conemail
FROM pgContact
WHERE pageId = $pageId";
}
elseif ($pageId == 102)
{
// Create a new XTemplate
$xtpl = new XTemplate ("templates/pgAboutForm.htm");
// Run the query
$query = "SELECT abHeading,
abPicture1,
abpicture2,
abpicturetext1,
abpicturetext2,
abparagraph1,
abparagraph2,
abparagraph3,
abparagraph4
FROM pgAbout
WHERE pageId = $pageId";
}
elseif ($pageId == 103)
{
// Create a new XTemplate
$xtpl = new XTemplate ("templates/pgMissionForm.htm");
// Run the query
$query = "SELECT misheading,
misparagraph1,
misparagraph2,
misparagraph3,
misparagraph4
FROM pgMission
WHERE pageId = $pageId";
}
elseif ($pageId >= 104)
{
// Create a new XTemplate
$xtpl = new XTemplate ("templates/categoryPagesForm.htm");
// Run the query
$query = "SELECT catHeading,
catSubHeading,
catPicture1,
catPicture2,
catParagraph1,
catParagraph2,
catParagraph3,
catParagraph4,
catTitle,
catDesc,
catKywd1,
catKywd2,
catKywd3,
catKywd4,
catKywd5,
catKywd6,
catKywd7,
catKywd8,
catKywd9,
catKywd10,
catKywd11,
catKywd12
FROM catPages
WHERE pageId = $pageId";
}
else
pageIdError();
if (!($result = @ mysql_query($query, $connection)))
showerror();
$row = mysql_fetch_array($result);
if($pageId == 100)
{
// Assign the fields to the home template
$xtpl->assign("hmHeading", $row["hmHeading"]);
$xtpl->assign("hmSubHeading", $row["hmSubHeading"]);
$xtpl->assign("hmPicture1", $row["hmPicture1"]);
$xtpl->assign("hmPicture2", $hmPicture2);
$xtpl->assign("hmParagraph1", $hmParagraph1);
$xtpl->assign("hmParagraph2", $hmParagraph2);
$xtpl->assign("hmParagraph3", $hmParagraph3);
$xtpl->assign("hmParagraph4", $hmParagraph4);
}
elseif($pageId == 101)
{
// Assign the fields to the contact template
$xtpl->assign("conheading", $conheading);
$xtpl->assign("conStorename", $conStorename);
$xtpl->assign("conAddress", $conAddress);
$xtpl->assign("conCity", $conCity);
$xtpl->assign("conState", $conState);
$xtpl->assign("conzip", $conzip);
$xtpl->assign("conphone", $conphone);
$xtpl->assign("confax", $confax);
$xtpl->assign("conemail", $conemail);
}
elseif($pageId == 102)
{
// Assign the fields to the about template
$xtpl->assign("abHeading", $abHeading);
$xtpl->assign("abPicture1", $abPicture1);
$xtpl->assign("abpicture2", $abpicture2);
$xtpl->assign("abpicturetext1", $abpicturetext1);
$xtpl->assign("abpicturetext2", $abpicturetext2);
$xtpl->assign("abparagraph1", $abparagraph1);
$xtpl->assign("abparagraph2", $abparagraph2);
$xtpl->assign("abparagraph3", $abparagraph3);
$xtpl->assign("abparagraph4", $abparagraph4);
}
elseif($pageId == 103)
{
// Assign the fields to the mission template
$xtpl->assign("misheading", $misheading);
$xtpl->assign("misparagraph1", $misparagraph1);
$xtpl->assign("misparagraph2", $misparagraph2);
$xtpl->assign("misparagraph3", $misparagraph3);
$xtpl->assign("misparagraph4", $misparagraph4);
}
elseif ($pageId >= 104)
{
// Assign the fields to the cateogry entrance pages
$xtpl->assign("catHeading", $catHeading);
$xtpl->assign("catSubHeading", $catSubHeading);
$xtpl->assign("catPicture1", $catPicture1);
$xtpl->assign("catPicture2", $catPicture2);
$xtpl->assign("catParagraph1", $catParagraph1);
$xtpl->assign("catParagraph2", $catParagraph2);
$xtpl->assign("catParagraph3", $catParagraph3);
$xtpl->assign("catParagraph4", $catParagraph4);
$xtpl->assign("catTitle", $catTitle);
$xtpl->assign("catDesc", $catDesc);
$xtpl->assign("catKywd1", $catKywd1);
$xtpl->assign("catKywd2", $catKywd2);
$xtpl->assign("catKywd3", $catKywd3);
$xtpl->assign("catKywd4", $catKywd4);
$xtpl->assign("catKywd5", $catKywd5);
$xtpl->assign("catKywd6", $catKywd6);
$xtpl->assign("catKywd7", $catKywd7);
$xtpl->assign("catKywd8", $catKywd8);
$xtpl->assign("catKywd9", $catKywd9);
$xtpl->assign("catKywd10", $catKywd10);
$xtpl->assign("catKywd11", $catKywd11);
$xtpl->assign("catKywd12", $catKywd12);
}
else
pageIdError();
// Assign the page data to the template
$xtpl->parse("main.form");
// Parse the whole document
$xtpl->parse("main");
// Output the information to the page
$xtpl->out("main");
}
?>