close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Blog Results and Blog Detail pages producing errors

Thread began 9/23/2013 1:06 pm by sandy170299 | Last modified 9/23/2013 1:51 pm by sandy170299 | 686 views | 6 replies |

sandy170299

Blog Results and Blog Detail pages producing errors

I followed the tutorial at http://www.webassist.com/community/tutorials/view_tutorial.php?tutorial=Create-new-pages-from-PowerCMS-templates&accesscheck=/community/tutorials/view_tutorial.php?tutorial=Create-new-pages-from-PowerCMS-templates and have created pages based on this tutorial.

This is my query on the detail page:
SELECT 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


When I preview the page, I get the following error:Fatal error: Cannot redeclare GetSQLValueString() (previously declared in /home/lutche5/public_html/kingsburylaw/blog-details.php:5) in /home/lutche5/public_html/kingsburylaw/Templates/insidePages.dwt.php on line 121

If I remove the code that references the function, like i had to do on the blog results page (because this function already exists in the template), I get this error instead:Fatal error: Call to undefined function GetSQLValueString() in /home/lutche5/public_html/kingsburylaw/blog-details.php on line 13

I am going to attach the blog detail page for you.

Thank you.

Attached Files
blog-details.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the code for the GetSQLValueString function should have a function_exists check around it to rpevent it from being redeclared:



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;
}
}
Sign in to reply to this post

sandy170299

I'm still getting an error, even with this new code.

http://kingsburylaw.lutchenpc.com/blog-details.php?ID=3

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

sandy170299

see PM

Sign in to reply to this post

Jason ByrnesWebAssist

The if staement:

if (!function_exists("GetSQLValueString")) {

<GetSQLValueString function code>
}

needs to be on both the template and the the details page, it should be on any page that uses that function. I added it to the template to correct the problem.

Sign in to reply to this post

sandy170299

Got it - thank you!!!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...