Jump to content

fdgloworm

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Indianapolis, IN

fdgloworm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for your reply. I know the code needs cleaned up, but I wanted to get it working before I clean it up so I always have a working code to revert to if I break it. Your point of the duplicate headers got me working in the right direction -> the stylesheet with the correct formatting wasn't pulled with a require() statement before it was needed therefore there was no formatting. Then of course I had problems with duplicate CSS tags so I had to rename a few of the internal tags, and viola! It's all up and working. If anyone has hints and ideas on how to clean up the code without breaking it, I'm open to suggestions. It's a mess since it's a third party PHP script I'm using inside a div tag in my own site. It looks good and functions great in IE and Firefox, but doesn't look so good and works fine in Safari. This one is going to take some time to clean, I think. Again, thank you for the prompting on the headers. That got me going in the right direction! Aaron
  2. Hello, all. I don't know if this is an easy solution or not, but I have been searching this and other forums for days trying to find out the answer. I have a third-party calendar app in PHP that I am attempting to put into my website, inside a <div> tag. The tag is opened and closed correctly, and the calendar.php is included correctly. Here: <div id="content"><div id="breadCrumb"></div> <h2 id="pageName">Events Calendar<hr></h2> <div id="calendar"> <?php include ("calendar/calendar.php"); ?> </div> </div> My problem is that the table and other HTML formatting in the included calendar.php isn't parsed correctly. In other words, the calendar shows up, most of it looks right, but the table isn't there and the dates aren't clickable. Here is the included file: <? /* ©2004 Proverbs, LLC. All rights reserved. */ $setday = 0; $setmonth = 0; $setyear = 0; $setview = "calendar"; if (isset($_REQUEST['view']) && $_REQUEST['view'] != "") $setview = $_REQUEST['view']; if (isset($_REQUEST['day']) && $_REQUEST['day'] != "") $setday = $_REQUEST['day']; if (isset($_REQUEST['month']) && $_REQUEST['month'] != "") $setmonth = $_REQUEST['month']; if (isset($_REQUEST['year']) && $_REQUEST['year'] != "") $setyear = $_REQUEST['year']; if ($setview == "schedule") require ('schedule.inc.php'); else require ('calendar.inc.php'); $page->createpage($setday, $setmonth, $setyear); $page->displaypage(); ?> Which then I believe pulls this calendar.inc.php or schedule.inc.php. Both display without table formatting in the <div> mentioned above. Here is calendar.inc.php: <? /* ©2004 Proverbs, LLC. All rights reserved. */ if (eregi("calendar.inc.php", $_SERVER['PHP_SELF'])) { // redirect to calendar page header("Location: calendar.php"); exit; } if(!defined("CALENDAR_PAGE")) { define("CALENDAR_PAGE", TRUE); require ('base.inc.php'); class calendar_page extends base_calendar { // Constructor function calendar_page() { $this->base_calendar(); } function createpage($current_day, $current_month, $current_year) { // create the setup object $conf = new layout_setup; // create the language object $lang = new language; $adjustment = 3600 * $conf->time_adjustment; if ($conf->use_dst) $adjustment += 3600 * gmdate("I", time() + $adjustment); if ($current_month == "" || $current_month < 1 || $current_month > 12) $current_month = gmdate("n", time() + $adjustment); if ($current_year == "" || $current_year == 0) $current_year = gmdate("Y", time() + $adjustment); if ($current_year > (gmdate("Y", time() + $adjustment) + 10)) $current_year = gmdate("Y", time() + $adjustment) + 10; if ($current_year < (gmdate("Y", time() + $adjustment) - 5)) $current_year = gmdate("Y", time() + $adjustment) - 5; if ($current_year < 1980) $current_year = 1980; $browser_version = $this->makeheader(); if ($browser_version > 0) { if ($browser_version == 1) $this->pagelayout .= '<link rel="stylesheet" type="text/css" href="navstylesheet.css.php" /> '; if ($browser_version == 2) $this->pagelayout .= '<link rel="stylesheet" type="text/css" href="iestylesheet.css.php" /> '; $this->pagelayout .= '<script type="text/javascript" src="caljavascript.js.php"></script> <noscript><center><b>'.$lang->word_no_javascript.'</b></center></noscript> '; $this->closeheader(); } else { $this->closeheader(); unset($conf); unset($lang); // require alternate calendar require ('calendar.alt.php'); $altcalendar = new alt_calendar_page; $this->pagelayout .= $altcalendar->createpage($current_day, $current_month, $current_year); return; } $this->activeday = $current_day; $this->activemonth = $current_month; $this->activeyear = $current_year; $nextmonth = $current_month + 1; $nextyear = $current_year; $prevmonth = $current_month - 1; $prevyear = $current_year; if ($current_month == 1) { $prevmonth = 12; $prevyear = $current_year - 1; } if ($current_month == 12) { $nextmonth = 1; $nextyear = $current_year + 1; } $this->pagelayout .= '<center> <form method="post" name="calendarPage" action="calendar.php"> <table class="calendar" cellspacing="0" cellpadding="0" border="0"> <tr> <td class="calmenu" style="width: 100%; text-align: center" colspan="7"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap class="calmenu" style="width: 250px"> <b>'.$lang->word_today_date.': </b>'.$lang->month_long[gmdate("n", time() + $adjustment)].gmdate(" j, Y", time() + $adjustment).' </td> <td class="calmenu" style="width: 460px; text-align: right"> <b>'.$lang->word_month.': </b> <select name="month"> '; for ($i = 1; $i <= 12; $i++) { $this->pagelayout .= '<option value="'.$i.'"'; if ($i == $this->activemonth) $this->pagelayout .= ' selected'; $this->pagelayout .= '>'.$lang->month_long[$i].'</option> '; } $this->pagelayout .= '</select> <b>'.$lang->word_year.': </b> <select name="year"> '; for ($i = (gmdate("Y") - 2); $i <= (gmdate("Y") + 10); $i++) { $this->pagelayout .= '<option value="'.$i.'"'; if ($i == $this->activeyear) $this->pagelayout .= ' selected'; $this->pagelayout .= '>'.$i.'</option> '; } $this->pagelayout .= '</select> <input type="button" style="width: 80px" name="refresh" value="'.$lang->word_refresh.'" onclick="ensureRefresh();" /> <br /> '; if ($conf->show_admin_link) $this->pagelayout .= '<a class="calmenu" href="caladmin/caladmin.php" target="caladmin"><u>'.$lang->word_administration.'</u></a> '; $this->pagelayout .= '</td> </tr> </table> </td> </tr> <tr> <td class="calhead" colspan="7"> <table class="calhead" cellspacing="0" cellpadding="0" border="0"> <tr> <td class="caltitle" colspan="3"> <input type="hidden" name="day" value="" /> <input type="hidden" name="view" value="calendar" /> '; if (trim($conf->calendar_title_image) != '') $this->pagelayout .= '<img src="'.$conf->calendar_title_image.'" alt="'.$conf->calendar_title_text.'" />'; else $this->pagelayout .= $conf->calendar_title_text; $this->pagelayout .= ' </td> </tr> <tr> <td class="calmonths" style="text-align: left"> '; if ($prevyear > 1979 && $prevyear > (gmdate("Y", time()) - 6)) $this->pagelayout .= '<a class="calmonths" href="calendar.php?month='.$prevmonth.'&year='.$prevyear.'"><b><< '.$lang->month_long[$prevmonth].' '.$prevyear.'</b></a>'; $this->pagelayout .= ' </td> <td class="calmonths" style="width: 300px; font-size: 16px"> <b>'.$lang->month_long[$current_month].' '.$current_year.'</b> </td> <td class="calmonths" style="text-align: right"> '; if ($nextyear < (gmdate("Y", time()) + 11)) $this->pagelayout .= '<a class="calmonths" href="calendar.php?month='.$nextmonth.'&year='.$nextyear.'"><b>'.$lang->month_long[$nextmonth].' '.$nextyear.' >></b></a>'; else $this->pagelayout .= ' '; $this->pagelayout .= ' </td> </tr> </table> </td> </tr> <tr> '; if (isset($conf->calendar_start_day) && $conf->calendar_start_day <= 6 && $conf->calendar_start_day >= 0) $n = $conf->calendar_start_day; else $n = 0; for ($i = 0; $i < 7; $i++) { if ($n > 6) $n = 0; $this->pagelayout .= '<td class="calweekday" nowrap> <b>'.$lang->day_long[$n].'</b> </td> '; $n++; } $this->pagelayout .= '</tr> '; $this->makecalendar($current_month, $current_year, $conf->calendar_start_day); $this->pagelayout .= '</table> </form> <a class="calmenu" style="font-size: 10px" href="http://www.proverbs.biz" target="_blank">Web Calendar ©2004 Proverbs, LLC. All rights reserved.</a> </center>'; unset($conf); unset($lang); } function makecalendar($current_month, $current_year, $startweekday) { $firstweekday = gmdate("w", gmmktime(0, 0, 0, $current_month, 1, $current_year)); $lastday = 28; for ($i = $lastday; $i < 32; $i++) { if (checkdate($current_month, $i, $current_year)) $lastday = $i; } $todayday = 0; $conf = new layout_setup; $adjustment = 3600 * $conf->time_adjustment; if ($conf->use_dst) $adjustment += 3600 * date("I", time() + $adjustment); if ($current_month == gmdate("n", time() + $adjustment) && $current_year == gmdate("Y", time() + $adjustment)) $todayday = gmdate("j", time() + $adjustment); $calday = 1; $calaccess = new caldbaccess; while ($calday <= $lastday) { $this->pagelayout .= '<tr> '; for ($j = 0; $j < 7; $j++) { if ($j == 0) $n = $startweekday; else { if ($n < 6) $n = $n + 1; else $n = 0; } if (($calday == 1 && $firstweekday == $n) || ($calday > 1 && $calday <= $lastday)) { $linesoftext = Array(); $itemcount = $calaccess->GetCalendarDateEvents($calday, $current_month, $current_year); for ($x = 0; $x < $itemcount; $x++) { $calaccess->next_record(); $linesoftext[] = $calaccess->f('short_description'); } $itemcount = $calaccess->GetCalendarDayEvents($calday, $current_month, $current_year); for ($x = 0; $x < $itemcount; $x++) { $calaccess->next_record(); $linesoftext[] = $calaccess->f('short_description'); } if ($todayday > 0 && $todayday == $calday) $this->addcalday($calday, true, $linesoftext); else $this->addcalday($calday, false, $linesoftext); $calday++; } else $this->pagelayout .= '<td class="calday" style="cursor: default"> </td> '; } unset ($caldb); $this->pagelayout .= '</tr> '; } unset($conf); } function addcalday($curday, $istoday, $textdisplay) { // create the setup object $tempconf = new layout_setup; if ($istoday) $this->pagelayout .= '<td nowrap class="calday" style="background-color: #'.$tempconf->calendar_today_background_color.'" onmouseover="tdmv(this)" onmouseout="tdtmo(this)" onclick="sendDay('.$curday.', '.$this->activemonth.', '.$this->activeyear.')"> '.$curday.'<br /> '; else $this->pagelayout .= '<td nowrap class="calday" onmouseover="tdmv(this)" onmouseout="tdmu(this)" onclick="sendDay('.$curday.', '.$this->activemonth.', '.$this->activeyear.')"> '.$curday.'<br /> '; unset($tempconf); // create the language object $templang = new language; if ($textdisplay != "" && count($textdisplay) > 0) { for ($i = 0; $i < count($textdisplay); $i++) { $displine = ''; if (strlen(trim($textdisplay[$i])) > 21) $displine = trim(substr(trim($textdisplay[$i]), 0, 18)).'...'; else $displine = trim($textdisplay[$i]); $displine .= '<br /> '; if ($i < 4) $this->pagelayout .= $displine; if ($i == 5) $this->pagelayout .= '<center><< '.$templang->word_more.' >></center> '; } } unset($templang); $this->pagelayout .= '</td> '; } } } // Create the calendar object. $page = new calendar_page; ?> Which uses the function makeheader() and pagelayout from this file: <? /* ©2004 Proverbs, LLC. All rights reserved. */ if (eregi("base.inc.php", $_SERVER['PHP_SELF'])) { // redirect to calendar page header("Location: calendar.php"); exit; } if(!defined("BASE_CALENDAR")) { define("BASE_CALENDAR", TRUE); require ('setup.inc.php'); require ('language.inc.php'); require ('calaccess.inc.php'); class base_calendar { var $pagelayout; var $activeday; var $activemonth; var $activeyear; // Constructor function base_calendar() { $this->pagelayout = ''; } function checkbrowser() { // create the setup object $conf = new layout_setup; $javaallowed = $conf->enable_javacss; unset($conf); if (!isset($_SERVER['HTTP_USER_AGENT']) || !$javaallowed) return 0; if (eregi("Opera", $_SERVER['HTTP_USER_AGENT']) || eregi("Firefox", $_SERVER['HTTP_USER_AGENT'])) return 1; if (eregi("MSIE", $_SERVER['HTTP_USER_AGENT'])) { if (intval(trim(substr($_SERVER['HTTP_USER_AGENT'], 4 + strpos($_SERVER['HTTP_USER_AGENT'], "MSIE"), 2))) >= 4) return 2; } if (eregi("Netscape", $_SERVER['HTTP_USER_AGENT'])) { if (eregi("Netscape6", $_SERVER['HTTP_USER_AGENT'])) return 1; if (intval(trim(substr($_SERVER['HTTP_USER_AGENT'], 9 + strpos($_SERVER['HTTP_USER_AGENT'], "Netscape"), 2))) >= 6) return 1; } return 0; } function makeheader() { // create the setup object $conf = new layout_setup; // create the language object $lang = new language; $retversion = $this->checkbrowser(); $this->pagelayout = '<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$lang->lang_value.'" lang="'.$lang->lang_value.'"> <head> <title>'.$conf->calendar_title_text.'</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta name="Description" content="'.$conf->calendar_title_text.'" /> '; unset($conf); unset($lang); return $retversion; } function closeheader() { $this->pagelayout .= '</head> <div leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"> '; } function displaypage() { $this->pagelayout .= ' </div> </html>'; echo $this->pagelayout; } } } ?> Now, this webpage shows what it should look like, hosted at my site, displayed as a single file: http://actoninfotech.dot5hosting.com/cgi-bin/ESTA/calendar/calendar.php And this page shows how it is displaying inside the <div> tag: http://actoninfotech.dot5hosting.com/cgi-bin/ESTA/calendar.php?month=8&year=2009 I know this is a long post for a short question: what do I need to change to get the proper formatting and have the second <div> tagged link look like the first standalone link? I have tried several different things, like taking the header, <html> and <body> tags out, thinking they were doubling up (tags inside tags) but that didn't do anything. I am at a loss. Any help would be appreciated. Thanks. fdgloworm
  3. Hello everyone. I'm hoping this forum can help me out. I am teaching myself PHP, AJAX, Javascript and MySQL programming and have been at it for over a year off and on, but just started with AJAX. I have borrowed many books from the library to answer my questions, but some questions the books just don't cover. Ok - some background on the platform. I am using Dreamweaver 8 with MX Kollection 3 and MX AJAX toolbox to put my code together. I use the GUI as often as I code by hand. I use WampServer to test it all, and a professional hosting company for live server. My problem is I have a PHP page(internal_request.php) that holds multiple forms in a switch:case setup. This page is displayed by the internal_request.js file which instantiates and runs the AJAX requests. The AJAX requests are called from one of two pages (createAgenda.php and editAgenda.php). My problem comes when using the MX Kollection Datepicker widget - it will not display the widget when the widget is included in the internal_request.php file (my guess is becuase it is called by the AJAX in the .js file) but it displays fine in the portion of the pages not sent by AJAX. I have included all the includes, js files, etc that I can in both the calling file and the internal_request.php file. Any ideas? I hope these snippets help: Snippet of internal_request.php without the switch:case - that works like a charm: This is a test for the datepicker without using a form tag. <br> <input name="testDatepicker" id="testDatepicker" value="" size="12" maxlength="10" wdg:subtype="Calendar" wdg:mask="<?php echo $KT_screen_date_format; ?>" wdg:type="widget" wdg:mondayfirst="true" wdg:singleclick="false" wdg:restricttomask="yes" wdg:readonly="true" /> Here is the snippet of code from one of the calling pages, editAgenda.php: <div id="content"> <?php if (!isset($_GET['p_key'])) {?> <div id="noedit" align="center"> There seems to be an error in retrieving your agenda. Please return to the agenda list and try again. If this error continues, please contact the application administrator. </div> <?php } else {?> <div id="editAgenda" align="center"> <form id="agenda" name="agenda" method="post" action=""> <input type="hidden" name="courseType" id="courseType" value="<?php echo $rseditType->Fields('type'); ?>"> <input type="hidden" name"p_key" id="p_key" value="<?php echo $_GET['p_key']; ?>"> <?php echo "<script language=javascript>editForms()</script>"; ?> <div id="form_cage" align="center"> <br> </div> <input name="updateAgenda" type="submit" id="updateAgenda" value="Update"> </form> </div> <?php } ?> </div> Here is the complete internal_application.js file: /* The following function creates an XMLHttpRequest object... */ function createRequestObject(){ var request_o; //declare the variable to hold the object. var browser = navigator.appName; //find the browser name if(browser == "Microsoft Internet Explorer"){ /* Create the object using MSIE's method */ request_o = new ActiveXObject("Microsoft.XMLHTTP"); }else{ /* Create the object using other browser's method */ request_o = new XMLHttpRequest(); } return request_o; //return the object } /* You can get more specific with version information by using parseInt(navigator.appVersion) Which will extract an integer value containing the version of the browser being used. */ /* The variable http will hold our new XMLHttpRequest object. */ var http = createRequestObject(); /* Function called to get the product categories list */ function getForms(){ /* Create the request. The first argument to the open function is the method (POST/GET), and the second argument is the url... document contains references to all items on the page We can reference document.form_category_select.select_category_select and we will be referencing the dropdown list. The selectedIndex property will give us the index of the selected item. */ http.open('post', 'internal_request.php',true); var params ="courseType=" + document.agenda.courseType.value + "&courseDate=" + document.agenda.courseDate.value + "&startTime=" +document.agenda.startTime.value + "&endTime=" + document.agenda.endTime.value + "&selectLocation=" + document.agenda.selectLocation.value + "&maxParticipants=" + document.agenda.maxParticipants.value; /* Define a function to call once a response has been received. This will be our handleProductCategories function that we define below. */ /*Changing options to attempt a POST rather than a GET */ //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = handleForms; /* Send the data. We use something other than null when we are sending using the POST method. */ http.send(params); } /* Function called to get the product categories list */ function editForms(){ /* Create the request. The first argument to the open function is the method (POST/GET), and the second argument is the url... document contains references to all items on the page We can reference document.form_category_select.select_category_select and we will be referencing the dropdown list. The selectedIndex property will give us the index of the selected item. */ http.open('post', 'internal_request.php',true); var params ="courseType=" + document.agenda.courseType.value + "&p_key=" + document.agenda.p_key.value; /* Define a function to call once a response has been received. This will be our handleProductCategories function that we define below. */ /*Changing options to attempt a POST rather than a GET */ //Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = handleForms; /* Send the data. We use something other than null when we are sending using the POST method. */ http.send(params); } /* Function called to handle the list that was returned from the internal_request.php file.. */ function handleForms(){ /* Make sure that the transaction has finished. The XMLHttpRequest object has a property called readyState with several states: 0: Uninitialized 1: Loading 2: Loaded 3: Interactive 4: Finished */ if(http.readyState == 4){ //Finished loading the response /* We have got the response from the server-side script, let's see just what it was. using the responseText property of the XMLHttpRequest object. */ var response = http.responseText; /* And now we want to change the product_categories <div> content. we do this using an ability to get/change the content of a page element that we can find: innerHTML. */ document.getElementById('form_cage').innerHTML = response; } } And then here is the list of includes and javascript files. I put them in all the pages as a troubleshooting method to see if any one of them would work once it had all the includes and files. require_once('Connections/chplibc_erti.php'); require_once('includes/wdg/WDG.php'); require_once('includes/functions.inc.php'); require_once('includes/common/KT_common.php'); require_once('includes/tng/tNG.inc.php'); <script type="text/javascript" src="includes/common/js/sigslot_core.js"></script> <script src="includes/common/js/base.js" type="text/javascript"></script> <script src="includes/common/js/utility.js" type="text/javascript"></script> <script type="text/javascript" src="includes/wdg/classes/MXWidgets.js"></script> <script type="text/javascript" src="includes/wdg/classes/MXWidgets.js.php"></script> <script type="text/javascript" src="includes/wdg/classes/Calendar.js"></script> <script type="text/javascript" src="includes/wdg/classes/SmartDate.js"></script> <script type="text/javascript" src="includes/wdg/calendar/calendar_stripped.js"></script> <script type="text/javascript" src="includes/wdg/calendar/calendar-setup_stripped.js"></script> <script src="includes/resources/calendar.js"></script> <link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /> <script language="javascript" type="text/javascript" src="includes/jaxon/js/internal_request.js"></script> Of course all of the includes are between <head> and </head>. Can anyone help me out? I just want the widget to appear!
  4. Okay. First, system setup: Windows XP Pro, running WAMP5(1.7.3), Apache, MySQL and MSSQL 2005 with webpages edited in Dreamweaver 8 with Kollection3 Pro, PHAkt 3.7.1, and MX Ajax Toolbox 1.0.0. I know coding by hand is better, but I'm teaching myself as I go, and trying to eke out extra money putting things together while I go. The problem is - most of my work has been in PHP and MySQL which was easy with Dreamweaver. DW did most of the routine stuff I had already learned but didn't have time to hand code, and of course some of the more advanced stuff I haven't learned yet. Unfortunately, my part-time employer asked me to create a database for implementation on their system - Windows with MSSQL 2000. I have run into problems with the code created by DW for interacting with the MSSQL database - the code generated by DW uses just table names, and I get 'unknown object' errors. If I replace the table name with 'db.table' then everything works. The next problem is some of the already-created code uses several includes and other files from the Kollection and PHAkt suites. I am trying to find a quick way to change (in as few files as possible) where the DB code needs to be altered, but I keep finding more and more files (connection includes, log includes, etc). My question is this: Is there one place to make this change, or can I upgrade ADODB to make this work without having to make tons of changes to code I've already written/created? Any ideas other than start over and code everything by hand? I know that would work, but I'm in a time crunch right now. Any ideas would be appreciated. Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.