|
|
Due to the volume of spam happening on our forums, posting is now restricted to verified members only. If you're not verified, drop us a note with your username.
|
|
Home > FlexCMS Support Forum > User Help > General Support Requests > Guestbook in a right block
FlexCMS Support Forum
Guestbook in a right block Started August 22, 2006 @ 11:08pm by cberks
|
Post Message |
|
|
Guestbook in a right block | August 22, 2006 @ 11:08pm | Thanks for answering my previous questions so promptly!!!
Here is next question -- I am experimenting with changing the template as you will see at http://www.gmcbennington.info/cblog/index.php/index.html
I have created a custom right block and put the guestbook code in it.
I still have some work to do to identify where the horizontal rule is between the entries as I might want to remove those and also probably will want to put a <br> between posted by and the date and also change "sign the guestbook" to "please comment" or something like that -- however the problem I need guidance on is that that right block works fine on all pages except for the calendar (Error. No Form Data)-- the main menu is at bottom of page and as you can see I have moved the left column in the template so that I get center column left column and right column in that order -- shows the flex on flexcms :=)
Regards, Chris |
|
|
|
|
|
|
| |
DCSun Administrator
Posts: 625 |
|
|
| August 23, 2006 @ 2:09pm | Chris,
Please post the code you're using in the block and we'll see what we can do.
David
FlexCMS v3.2 Has Been Released! |
|
|
|
|
|
|
| |
|
|
Block code used for guestbook | August 23, 2006 @ 4:30pm |
Code
/* FlexCMS (http://www.flexcms.com) Flexible, Powerful, Affordable.
Module: Guestbook Submodule: Filename: inc-gb-idx.php
Version: 1.3
Contents of this file are protected by the copyright notice found at http://www.flexcms.com/index.php/pages/copyright.html, and its usage is subject to the terms of the licensing agreement available at http://www.flexcms.com/index.php/pages/license.html */
// ======================================================================================== // main guestbook script // ======================================================================================== $query = "select * from `".$Settings['DBPrefix']."gb-Settings`"; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $gbSettings[$row['Name']] = $row['Value']; } if ($gbSettings['EntriesPerPage'] < 1) { $gbSettings['EntriesPerPage'] = 10; } if ($Arguments2 != 'sign') { if ($gbSettings['PageTitle'] != '') { // print '<div align="'.$AlignmentCodes[$gbSettings['TitleAlignment']].'">'.$gbSettings['PageTitle'].'</div>'; // $BrowserTitle = $gbSettings['PageTitle']; // $LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > '.$gbSettings['PageTitle']; } else { // print '<div align="'.$AlignmentCodes[$gbSettings['TitleAlignment']].'">'.$MsgText[6][4].'</div>'; // $BrowserTitle = $MsgText[6][4]; // $LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > '.$MsgText[6][4]; } //print '<br>'.$MsgText[6][5].'<br><br>'; // figure out how many messages there are $query = "select count(RecordNumber) as MessagesCount from `".$Settings['DBPrefix']."gb-Messages` where Approved=1"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); $GBMessagesCount = $row['MessagesCount']; $LastPage = ceil($GBMessagesCount/$gbSettings['EntriesPerPage']); $Arguments2 = intval($Arguments2); if ($Arguments2 == '' || $Arguments2 == 0) { $GBPage = 1; } else if ($Arguments2 > $LastPage) { $GBPage = $LastPage; } else { $GBPage = $Arguments2; } $GBMessagesStart = (($GBPage-1)*$gbSettings['EntriesPerPage']); if ($GBMessagesCount > $gbSettings['EntriesPerPage']) { if ($GBPage > 1) { $PreviousPageLink = '<a href="'.$MainURL.'/guestbook/'.($GBPage-1).'.html">< '.$MsgText[6][18].'</a>'; } else { $PreviousPageLink = ' '; } if ($GBPage < $LastPage) { $NextPageLink = '<a href="'.$MainURL.'/guestbook/'.($GBPage+1).'.html">'.$MsgText[6][17].' ></a>'; } else { $NextPageLink = ' '; } $PageLinks = '<div align="center"><table width="100" border="0" cellpadding="0" cellspacing="0"><tr> <td width="45%" align="left"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$PreviousPageLink.'</b></font></td> <td width="10%" align="center"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$GBPage.'</b></font></td> <td width="45%" align="right"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$NextPageLink.'</b></font></td> </tr></table></div><br><br>'; } if ($gbSettings['SortDirection'] == 'desc' || $gbSettings['SortDirection'] == '') { $SortDirection = 'desc'; } else { $SortDirection = 'asc'; } $query = "select * from `".$Settings['DBPrefix']."gb-Messages` where Approved=1 order by DateCode ".$SortDirection." limit ".$GBMessagesStart.",".$gbSettings['EntriesPerPage']; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $row['Message'] = str_replace('<','<',$row['Message']); $row['Message'] = str_replace("\n",'<br>',$row['Message']); print '<br><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr></table><br>'.$row['Message'].'<br><b><font size="'.($FontSize-1).'">'.$MsgText[6][6].' '.$row['Name'].' '.$MsgText[6][7].' '.date('F j, Y @ g:ia',$row['DateCode']).'</font></b><br>'; } $A6 = intval(time()/60/60/24); $A7 = substr($Settings['lks'],10,5); print '<br><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr></table>'; $JSCode[1] = 'document.forms["SubmitForm"].elements["A4"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value)); document.forms["SubmitForm"].elements["A5"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)+parseInt(document.forms["SubmitForm"].elements["A3"].value));'; $JSCode[2] = 'document.forms["SubmitForm"].elements["A4"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)-parseInt(document.forms["SubmitForm"].elements["A3"].value)); document.forms["SubmitForm"].elements["A5"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)+(parseInt(document.forms["SubmitForm"].elements["A3"].value)*parseInt(document.forms["SubmitForm"].elements["A2"].value)));'; $JSCode[3] = 'document.forms["SubmitForm"].elements["A4"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value)); document.forms["SubmitForm"].elements["A5"].value = (parseInt(document.forms["SubmitForm"].elements["A3"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value));'; $JSCode[4] = 'document.forms["SubmitForm"].elements["A4"].value = (Math.pow(parseInt(document.forms["SubmitForm"].elements["A2"].value),2)); document.forms["SubmitForm"].elements["A5"].value = (Math.floor(Math.PI*parseInt(document.forms["SubmitForm"].elements["A2"].value)));'; $JSCode[5] = 'document.forms["SubmitForm"].elements["A4"].value = ((parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value))-parseInt(document.forms["SubmitForm"].elements["A2"].value)); document.forms["SubmitForm"].elements["A5"].value = ((parseInt(document.forms["SubmitForm"].elements["A2"].value)*47)+parseInt(document.forms["SubmitForm"].elements["A3"].value));'; $A1 = rand(1,5); $A2 = rand(10,99); $A3 = rand(100,999); print '<br><br>'.$PageLinks.'<br><br><a name="sign"></a><b>'.$MsgText[6][8].':</b><br><form name="SubmitForm" action="'.$MainURL.'/guestbook/sign" method="post"><input type="hidden" name="A1" value="'.$A1.'"><input type="hidden" name="A2" value="'.$A2.'"><input type="hidden" name="A3" value="'.$A3.'"><input type="hidden" name="A4" value=""><input type="hidden" name="A5" value=""><input type="hidden" name="A6" value="'.dechex($A6).'"><input type="hidden" name="A7" value="'.$A7.'"><script>'.$JSCode[$A1].'</script><noscript><br><br><b>JavaScript MUST be enabled for this form to function. You are seeing this message because JavaScript is NOT currently enabled on your system.</b><br><br></noscript> '.$MsgText[6][9].':<br><input type="text" name="Name" size="25" maxlength="255" style="'.$FormStyle.'"> <br><br> '.$MsgText[6][10].':<br><textarea name="Message" cols="20" rows="4" wrap="virtual" style="'.$FormStyle.'"></textarea> <br><br><br> <input type="submit" value="'.$MsgText[6][11].'" style="'.$FormStyle.'"> </form>'; } else { // print '<div align="'.$AlignmentCodes[$gbSettings['TitleAlignment']].'">'.$MsgText[6][11].'</div>'; $BrowserTitle = $MsgText[6][11]; $LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > '.$MsgText[6][11]; ReadFormArguments(); Global $FormArguments; $FormValidated1 = false; if ($FormArguments['A1'] == 1) { if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A3'])) && ($FormArguments['A5'] == ($FormArguments['A2']+$FormArguments['A3']))) { $FormValidated1 = true; } } else if ($FormArguments['A1'] == 2) { if (($FormArguments['A4'] == ($FormArguments['A2']-$FormArguments['A3'])) && ($FormArguments['A5'] == ($FormArguments['A2']+($FormArguments['A3']*$FormArguments['A2'])))) { $FormValidated1 = true; } } else if ($FormArguments['A1'] == 3) { if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A2']*$FormArguments['A3'])) && ($FormArguments['A5'] == ($FormArguments['A3']*$FormArguments['A3']))) { $FormValidated1 = true; } } else if ($FormArguments['A1'] == 4) { if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A2'])) && ($FormArguments['A5'] == floor(M_PI*$FormArguments['A2']))) { $FormValidated1 = true; } } else if ($FormArguments['A1'] == 5) { if (($FormArguments['A4'] == ($FormArguments['A2']*$FormArguments['A3'])-$FormArguments['A2']) && ($FormArguments['A5'] == ($FormArguments['A2']*47)+$FormArguments['A3'])) { $FormValidated1 = true; } } $FormValidated2 = false; if (hexdec($FormArguments['A6']) <= (intval(time()/60/60/24)+2) && $FormArguments['A7'] == substr($Settings['lks'],10,5)) { $FormValidated2 = true; } if (count($FormArguments) > 0 && $FormArguments['Message'] != '' && $FormValidated1 == true && $FormValidated2 == true) { $FormArguments['Name'] = $FormArguments['Name']; $FormArguments['Message'] = $FormArguments['Message']; if ($FormArguments['Name'] == '') { $FormArguments['Name'] = 'Anonymous'; } if ($gbSettings['Notify'] == 'y') { if ($gbSettings['NotifyEmail'] != '') { $NotifyEmail = $gbSettings['NotifyEmail']; } else { $NotifyEmail = $Settings['ContactEmail']; } if ($gbSettings['RequireApproval'] == 'y') { $ApprovalPart = ' Please log into the site and visit your Control Panel to review this message and approve it for display on the site.'; } $Message = "\n".'A new guestbook message has been posted.'.$ApprovalPart."\n\n\n".$MsgText[0][142].','."\n".$Settings['SiteName']."\n".$IndexURL; mail($NotifyEmail, 'New Guestbook Message Posted', $Message, 'From: "'.$Settings['SiteName'].'" <'.$Settings['ContactEmail'].'>','-f'.$Settings['ContactEmail']); } if ($gbSettings['RequireApproval'] != 'y') { $query = "insert into `".$Settings['DBPrefix']."gb-Messages` (Name,Message,DateCode,Approved) values ('".$FormArguments['Name']."','".$FormArguments['Message']."','".time()."',1)"; $result = mysql_query($query) or die (mysql_error()); header('Location: '.$MainURL.'/guestbook.html'); } else { $query = "insert into `".$Settings['DBPrefix']."gb-Messages` (Name,Message,DateCode,Approved) values ('".$FormArguments['Name']."','".$FormArguments['Message']."','".time()."',0)"; $result = mysql_query($query) or die (mysql_error()); print '<br><br>Thank you for signing our guestbook. To help reduce spam and make sure all messages are appropriate, we will be reviewing your message before it appears on the site, so it will not appear on the site until it is approved.<br><br><br><a href="'.$MainURL.'/guestbook.html">Back To Guestbook</a>'; } } else { print $MsgText[0][98]; } } // ========================================================================================
|
|
|
|
|
|
|
|
|
| |
DCSun Administrator
Posts: 625 |
|
|
| August 23, 2006 @ 4:39pm | Chris,
Try this and see if that solves your problem.
Code
$query = "select * from `".$Settings['DBPrefix']."gb-Settings`"; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $gbSettings[$row['Name']] = $row['Value']; } if ($gbSettings['EntriesPerPage'] < 1) { $gbSettings['EntriesPerPage'] = 10; }
// figure out how many messages there are $query = "select count(RecordNumber) as MessagesCount from `".$Settings['DBPrefix']."gb-Messages` where Approved=1"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); $GBMessagesCount = $row['MessagesCount']; $LastPage = ceil($GBMessagesCount/$gbSettings['EntriesPerPage']); $Arguments2 = intval($Arguments2); if ($Arguments2 == '' || $Arguments2 == 0) { $GBPage = 1; } else if ($Arguments2 > $LastPage) { $GBPage = $LastPage; } else { $GBPage = $Arguments2; } $GBMessagesStart = (($GBPage-1)*$gbSettings['EntriesPerPage']); if ($GBMessagesCount > $gbSettings['EntriesPerPage']) { if ($GBPage > 1) { $PreviousPageLink = '<a href="'.$MainURL.'/guestbook/'.($GBPage-1).'.html">< '.$MsgText[6][18].'</a>'; } else { $PreviousPageLink = ' '; } if ($GBPage < $LastPage) { $NextPageLink = '<a href="'.$MainURL.'/guestbook/'.($GBPage+1).'.html">'.$MsgText[6][17].' ></a>'; } else { $NextPageLink = ' '; } $PageLinks = '<div align="center"><table width="400" border="0" cellpadding="0" cellspacing="0"><tr> <td width="45%" align="left"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$PreviousPageLink.'</b></font></td> <td width="10%" align="center"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$GBPage.'</b></font></td> <td width="45%" align="right"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$NextPageLink.'</b></font></td> </tr></table></div><br><br>'; } if ($gbSettings['SortDirection'] == 'desc' || $gbSettings['SortDirection'] == '') { $SortDirection = 'desc'; } else { $SortDirection = 'asc'; } $query = "select * from `".$Settings['DBPrefix']."gb-Messages` where Approved=1 order by DateCode ".$SortDirection." limit ".$GBMessagesStart.",".$gbSettings['EntriesPerPage']; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $row['Message'] = str_replace('<','<',$row['Message']); $row['Message'] = str_replace("\n",'<br>',$row['Message']); $PageContents .= '<br><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr></table><br>'.$row['Message'].'<br><b><font size="'.($FontSize-1).'">'.$MsgText[6][6].' '.$row['Name'].' '.$MsgText[6][7].' '.date('F j, Y @ g:ia',$row['DateCode']).'</font></b><br>'; } $A6 = intval(time()/60/60/24); $A7 = substr($Settings['lks'],10,5); $PageContents .= '<br><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="'.$Colors['Text'].'"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr></table>'; $JSCode[1] = 'document.forms["SubmitForm"].elements["A4"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value)); document.forms["SubmitForm"].elements["A5"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)+parseInt(document.forms["SubmitForm"].elements["A3"].value));'; $JSCode[2] = 'document.forms["SubmitForm"].elements["A4"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)-parseInt(document.forms["SubmitForm"].elements["A3"].value)); document.forms["SubmitForm"].elements["A5"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)+(parseInt(document.forms["SubmitForm"].elements["A3"].value)*parseInt(document.forms["SubmitForm"].elements["A2"].value)));'; $JSCode[3] = 'document.forms["SubmitForm"].elements["A4"].value = (parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value)); document.forms["SubmitForm"].elements["A5"].value = (parseInt(document.forms["SubmitForm"].elements["A3"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value));'; $JSCode[4] = 'document.forms["SubmitForm"].elements["A4"].value = (Math.pow(parseInt(document.forms["SubmitForm"].elements["A2"].value),2)); document.forms["SubmitForm"].elements["A5"].value = (Math.floor(Math.PI*parseInt(document.forms["SubmitForm"].elements["A2"].value)));'; $JSCode[5] = 'document.forms["SubmitForm"].elements["A4"].value = ((parseInt(document.forms["SubmitForm"].elements["A2"].value)*parseInt(document.forms["SubmitForm"].elements["A3"].value))-parseInt(document.forms["SubmitForm"].elements["A2"].value)); document.forms["SubmitForm"].elements["A5"].value = ((parseInt(document.forms["SubmitForm"].elements["A2"].value)*47)+parseInt(document.forms["SubmitForm"].elements["A3"].value));'; $A1 = rand(1,5); $A2 = rand(10,99); $A3 = rand(100,999); $PageContents .= '<br><br>'.$PageLinks.'<br><br><a name="sign"></a><b>'.$MsgText[6][8].':</b><br><form name="SubmitForm" action="'.$MainURL.'/guestbook/sign" method="post"><input type="hidden" name="A1" value="'.$A1.'"><input type="hidden" name="A2" value="'.$A2.'"><input type="hidden" name="A3" value="'.$A3.'"><input type="hidden" name="A4" value=""><input type="hidden" name="A5" value=""><input type="hidden" name="A6" value="'.dechex($A6).'"><input type="hidden" name="A7" value="'.$A7.'"><script>'.$JSCode[$A1].'</script><noscript><br><br><b>'.$MsgText[0][633].'</b><br><br></noscript> '.$MsgText[6][9].':<br><input type="text" name="Name" size="25" maxlength="255" style="'.$FormStyle.'"> <br><br> '.$MsgText[6][10].':<br><textarea name="Message" cols="45" rows="4" wrap="virtual" style="'.$FormStyle.'"></textarea> <br><br><br> <input type="submit" value="'.$MsgText[6][11].'" style="'.$FormStyle.'"> </form>'; |
|
David
|
FlexCMS v3.2 Has Been Released! |
|
|
|
|
|
|
|
|
|
| MEMBERS
|
|
|