Re: [pro_php] Data driven content management
| From: | dwalker | Date: | Fri, 18 Apr 2003 07:05:26 +0000 |
| Subject: | Re: [pro_php] Data driven content management | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144385@lists.php.net to get a copy of this message | ||
I forgot to include my code:
<?php
require("./../adodb/adodb.inc.php");
require("./../Connections/inventory.php");
?><?php
$KT_numRows_GetColumn3Content = -1
?><?php
$KT_numRows_GetColumn2Content = -1
?><?php
$KT_numRows_GetColumn1Content = -1
?><?php
$GetColumn1Content = $inventory->Execute("SELECT * FROM SiteController
WHERE ExpirationDate > now() and ActivationDate < Now() AND ColumnNumber=1")
or KT_DIE($inventory->ErrorNo(),$inventory->ErrorMsg());
$GetColumn1Content_numRows=0;
$GetColumn1Content__totalRows=$GetColumn1Content->RecordCount();
?><?php
if (!isset($KT_error)) {
$KT_error = false;
}
if(isset($KT_FormState) && $KT_FormState == "NEW") $KT_error = true;
if (!$KT_error) {
$GetColumn2Content = $inventory->Execute("SELECT * FROM SiteController
WHERE ExpirationDate > now() and ActivationDate < Now() AND ColumnNumber
=2") or KT_DIE($inventory->ErrorNo(),$inventory->ErrorMsg());
$GetColumn2Content_numRows = 0;
$GetColumn2Content__totalRows = $GetColumn2Content->RecordCount();
} else {
$GetColumn2Content = &$KT_fakeRs;
}
?><?php
$GetColumn3Content = $inventory->Execute("SELECT * FROM SiteController
WHERE ExpirationDate > now() and ActivationDate < Now() AND ColumnNumber
=3") or KT_DIE($inventory->ErrorNo(),$inventory->ErrorMsg());
$GetColumn3Content_numRows=0;
$GetColumn3Content__totalRows=$GetColumn3Content->RecordCount();
?><?php
$Repeat1__numRows = -1;
$Repeat1__index= 0;
$GetColumn3Content_numRows = $GetColumn3Content_numRows +
$Repeat1__numRows;
?><?php
$Repeat2__numRows = -1;
$Repeat2__index= 0;
$GetColumn2Content_numRows = $GetColumn2Content_numRows +
$Repeat2__numRows;
?><?php
$Repeat3__numRows = -1;
$Repeat3__index= 0;
$GetColumn1Content_numRows = $GetColumn1Content_numRows +
$Repeat3__numRows;
?><?php
$GetActiveContent = $inventory->Execute("Select * from SiteController
where ExpirationDate > now() and ActivationDate < Now()") or
KT_DIE($inventory->ErrorNo(),$inventory->ErrorMsg());
$GetActiveContent_numRows=0;
$GetActiveContent__totalRows=$GetActiveContent->RecordCount();
?><?php
if (!isset($KT_error)) {
$KT_error = false;
}
if(isset($KT_FormState) && $KT_FormState == "NEW") $KT_error = true;
if (!$KT_error) {
$GetColumn3Includes = $inventory->Execute("SELECT * FROM SiteController
WHERE ColumnNumber=3") or
KT_DIE($inventory->ErrorNo(),$inventory->ErrorMsg());
$GetColumn3Includes_numRows = 0;
$GetColumn3Includes__totalRows = $GetColumn3Includes->RecordCount();
} else {
$GetColumn3Includes = &$KT_fakeRs;
}
?>
<p>
<TABLE width="713" border="0" height="373">
<tr>
<TD align="left" height="471" width="156"
valign="top">
<TABLE width="163" border="0" height="80"
align="left">
<TD align="left" height="35" valign="top"> <font
face="Verdana,
Arial, Helvetica, sans-serif" size="1"
color="#0000CC"></font></TD>
<tr>
<TD align="left" height="35" valign="top">
<?php while (($Repeat3__numRows-- != 0) &&
(!$GetColumn1Content->EOF))
{
?>
<span class="contentcolumn1borderinfo"> <a href="<?php echo
$GetColumn1Content->Fields("Eventnoteslink")?>">
<?php echo $GetColumn1Content->Fields("Eventnotes")?>
</a> <br>
</span>
<?php
$Repeat3__index++;
$GetColumn1Content->MoveNext();
}
?>
</TD>
<tr>
<TD align="left" height="35" valign="top">
<?php
$fileName =
$GetColumn1Content->Fields("Pagename");
echo $filename;
echo $GetColumn1Content->Fields("Pagename");
echo "test";
?>
</TD>
<tr>
<TD align="left" height="35"
valign="top"> </TD>
</TABLE>
</TD>
<TD align="left" height="471" width="312"
valign="top">
<TABLE width="264" border="0" align="center">
<TD align="center" height="35"
class="contentcolumn2borderinfo">
<?php
$fileName =
$GetColumn2Content->Fields("Pagepath").$GetColumn2Content->Fields("Pagename"
);
echo "Filename: $filename<br>\n";
?>
</TD>
<tr>
<TD align="center" height="42"
class="contentcolumn2borderinfo">
<?php while (($Repeat2__numRows-- != 0) &&
(!$GetColumn2Content->EOF))
{
?>
<span class="contentcolumn2borderinfo">
<?php echo $GetColumn2Content->Fields("Eventnotes")?>
<?php $getlinkinfo=
($GetColumn2Content->Fields("ImagePath").$GetColumn2Content->Fields("ImageNa
me"));?>
<?php echo $getlinkinfo ;?>
<?php include $getlinkinfo; ?>
</span>
<?php
$Repeat2__index++;
$GetColumn2Content->MoveNext();
}
?>
</TD>
<tr>
<TD align="center" height="42"> </TD>
<tr>
<TD align="center" height="42"
class="contentcolumn2borderinfo">
<?php require("home.php");?>
</TD>
</TABLE>
</TD>
<TD align="left" height="471" width="231"
valign="top">
<table width="214" border="0" cellspacing="2"
cellpadding="2">
<tr>
<td>
<?php//
include("$GetColumn3Includes->Fields("Pagepath").$GetColumn3Includes->Fields
("Pagename")");?>
</td>
</tr>
<tr>
<td class="contentcolumn3borderinfo">
<?php while (($Repeat1__numRows-- != 0) &&
(!$GetColumn3Content->EOF))
{
?>
<span class="contentcolumn3borderinfo">
<?php echo $GetColumn3Content->Fields("Eventnotes")?>
</span>
<?php
$Repeat1__index++;
$GetColumn3Content->MoveNext();
}
?>
</td>
</tr>
<tr>
<td>
<?
$fileName3 =
$GetColumn3Content->Fields("Pagepath").$GetColumn3Content->Fields("Pagename"
);
echo "$filename3<br>\n";
?>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</TD>
</TABLE>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<?php
$GetColumn1Content->Close();
?><?php
$GetColumn2Content->Close();
?><?php
$GetColumn3Content->Close();
?><?php
$GetColumn3Includes->Close();
?><?php
$GetActiveContent->Close();
?>
-----Original Message-----
From: dwalker <dwalker@healthyproductsplus.com>
To: professional php <pro_php@p2p.wrox.com>
Date: Friday, April 18, 2003 2:37 AM
Subject: [pro_php] Data driven content management
>I have a data driven page that assembles links to content (images and other
>files within the site) using information retrieved from my database. It
>works beautifully, except, I'm not sure how to force it to differentiate
>images from other files. Currently the page outputs the ascii
>representation of the image and not a human viewable picture.
>
>I have three columns (and some tables) within the page and 3 corresponding
>database searches for each column. ( columns are numbered from left to
>right). Each search is responsible for 'working' the database from top to
>bottom looking for content that hasn't expired, belongs in its column
and/or
>is scheduled to start. Content that is supposed to 'stick together' gets
>placed into the database one corresponding record after the other (in the
>order I want them viewed).
>
>I'm trying to write the code in such a way that I don't have to worry about
>the image versus 'other file' and thought I'd try to implement something
>within the database, but I'm not really sure what that something aught to
>be.
>
>Any suggestions would be much appreciated?
>
>NOTE: records within the database will be manipulated via another page
>within the site.
>
>To make it a little more complicated, I also have a table consisting of
>links to alternate images for the purpose of giving the site a little
flare.
>The image groups will have a Parent > child relationship and will
>interchange at a specific, currently unknown rate.
>
>
>The 'content' table is structured accordingly:
>
>
>SubmissionDate timestamp(14) NOT NULL, -- system generated. when content
>added to site
> ActivationDate date default NULL, -- date the content displays
> ExpirationDate date default NULL,--date the content expires
> Pagename varchar(50) default NULL,--page name of file to include
> Pagepath varchar(150) default NULL,--path to page name
> ImageName varchar(50) default NULL,--image name of image to include
> ImagePath varchar(255) default NULL,--path to image name
> Eventnotes varchar(255) default NULL,--notes about the content
> TextFileName varchar(50) default NULL,--name of txt file or XML file to
>include
> TextFilePath varchar(255) default NULL,--
> ColumnNumber int(11) default NULL,defines which column the content
belongs
> Eventnoteslink varchar(255), -- a link to more info about the content
>
>
>
>
>
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or
>to unsubscribe send a blank email to leave-pro_php-1319130N@p2p.wrox.com.
>