Blog
Is there a way to add the dates to the blogs? I'm looking for the dates to appear below the title in a smaller font.
Thansks
Is there a way to add the dates to the blogs? I'm looking for the dates to appear below the title in a smaller font.
Thansks
if you're following this tutorial:
http://www.youtube.com/watch?v=kbplAlzNexI
you can add the ContentDate to the recordset to return the blog date.
Thanks Jason,
Okay, I've got a date to show up but its wrong. It is showing (31/12/1969) as the date. How do I get it to show the date the blog was created. Here is the PHP code that I am using. I found it on another post:
<?php
include('WA_CMS/addtosite.php');
echo(date("d/m/Y",strtotime($row_NewsPanelRS['ContentDate'])));
?>
if you dont use the dat function, what is returned:
<?php
include('WA_CMS/addtosite.php');
echo $row_NewsPanelRS['ContentDate'];
?>
When I change it to your code nothing is returned.
ok, so the recordset is not returning the date, please send a copy of your page so i can view the code in context.
Here you go, I will send a link to the page so you can view it in a browser in the private message section.
<?php require_once('Connections/PowerCMSConnection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$post_BlogRS = "-1";
if (isset($_GET["ID"])) {
$post_BlogRS = $_GET["ID"];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_BlogRS = sprintf("SELECT C2.ContentDate, C2.ContentGroup, C2.ContentPageSetOrder FROM pcms2_contents AS C1 LEFT OUTER JOIN pcms2_contents AS C2 ON C2.ContentPagesetParentID = C1.ContentID WHERE C1.ContentGroup = 'blogPosts' AND C2.ContentPageSetOrder =%s GROUP BY C2.ContentPageSetOrder ORDER BY C2.ContentPageSetOrder DESC", GetSQLValueString($post_BlogRS, "int"));
$BlogRS = mysql_query($query_BlogRS, $PowerCMSConnection) or die(mysql_error());
$row_BlogRS = mysql_fetch_assoc($BlogRS);
$totalRows_BlogRS = mysql_num_rows($BlogRS);
?>
<?php require_once("WA_CMS/WA_CMS.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/sub-page.dwt.php" codeOutsideHTMLIsLocked="true" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Dr. Robyn Odegaard, Productive Conflict Resolutioin Expert, Internationally Acclaimed Motivational Speaker, Author and Executive Coach</title>
<!-- InstanceEndEditable -->
<link href="css/cp.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<div id="container">
<div id="masthead">
<div id="nav">
<?php include('includes/nav.inc.php'); ?>
</div>
<div id="main-banner"></div>
<div id="red-banner"><H1>Internationally Acclaimed Motivational Speaker, Author and Executive Coach</H1></div>
</div>
<div id="bottom">
<div id="left-side">
<div id="Sub-page-content">
<div id="main-headers"><!-- InstanceBeginEditable name="header" -->
<h1>Doc Robyn's </h1>
<!-- InstanceEndEditable --></div>
<!-- InstanceBeginEditable name="content" -->
<div id="Sub-page-content-list">
<?php
include('/homepages/19/d403739231/htdocs/champPerformance/WA_CMS/addtosite.php');
echo WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'blogPost', 'Blog Post Title', false, $row_BlogRS['ContentPageSetOrder'] );
?>
<h3><?php
include('WA_CMS/addtosite.php');
echo(date("d/m/Y",strtotime($row_NewsPanelRS['ContentDate'])));
?></h3>
<?php
include('/homepages/19/d403739231/htdocs/champPerformance/WA_CMS/addtosite.php');
echo WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'blogPost', 'Content', false, $row_BlogRS['ContentPageSetOrder'] );
?>
</div>
<!-- InstanceEndEditable --></div>
</div>
<div id="right-side">
<div id="totw">
<div id="main-headers">
<h1>Topic Of The Week</h1>
</div>
<div id="totw-content">
<?php
include('/homepages/19/d403739231/htdocs/champPerformance/WA_CMS/addtosite.php');
echo WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'blogPost', 'Blog Post Title', false, $row_BlogRS['ContentPageSetOrder'] );
?>
<?php
include('/homepages/19/d403739231/htdocs/champPerformance/WA_CMS/addtosite.php');
echo WA_getCMSContent($database_PowerCMSConnection, $PowerCMSConnection, 'blogPost', 'Content', false, $row_BlogRS['ContentPageSetOrder'] );
?>
</div>
<div id="totw-read-more">
<p><a href="drrobynodegaard-blog-details.php" title="Topic of the Week" target="_self">Click to read more ></a></p>
</div>
</div>
<div id="feature-week">
<div id="main-headers">
<h1>Featured Resource</h1>
</div>
<div id="feature-content">
<a id="box-link-fr" href="#" target="_blank"></a>
</div>
</div>
<div id="social-home">
<div id="social-header">Connect with us</div>
<div id="social-base">
<div id="facebook">
<p>Like us on Facebook</p>
<a id="box-link-facebook" href="https://www.facebook.com/ChampPerformance" target="_blank"></a>
</div>
<div id="twitter">
<p>Follow us on Twitter</p>
<a id="box-link-twitter" href="https://twitter.com/DocRobyn" target="_blank"></a>
</div>
<div id="linkedin">
<p>Connect on Linkedin</p>
<a id="box-link-linkedin" href="http://www.linkedin.com/in/robynodegaard" target="_blank"></a>
</div>
</div>
</div>
<div id="join-std"><a id="box-link-join-std" href="http://stopthedramanow.com" target="_blank"></a></div>
</div>
<div id="sign-off"><?php include('includes/sign-off.php'); ?></div>
</div>
</div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($BlogRS);
?>
your recordset is named BlogRS
this code is using a different recordset name:
echo(date("d/m/Y",strtotime($row_NewsPanelRS['ContentDate'])));
it needs to be:
echo(date("d/m/Y",strtotime($row_BlogRS['ContentDate'])));
NOTE: Instead of pasting the page code into the message, please compress the php page to a zip archive and attach the zip file.
Okay I missed that, sorry.
I updated the file but I'm still getting the 31/12/1969 date
I'll need to troubleshoot directly, see the private message section.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.