Jump to content

gckmac

Members
  • Posts

    25
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

gckmac's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It was a mistake to push the Report button. And I fully agree with Gurus. I've done this many times but am just having trouble in this instance.
  2. The problem is that having only 1 header include means that the Title & Description tags cannot change for the relevant page. This was bad coding for SEO purposes. Workaround is IF/ELSE, but having trouble implementing.
  3. I should add that the invoked file tpl_portfolio_category.html also references header.tpl: <? include_once 'parts/header.tpl'; ?> {header} <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td class="main"><h1><span class="firstLetter">{image_category}</span></h1> <p> </p> <table height="89" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="7"> </td> </tr> <!-- BEGIN block_thumb --> <tr> <td width='180' height="120" background="./images/thumb-bg.gif"> <div align="center">{thumb1}</div></td> <td width="10"> </td> <td width='180' background="./images/thumb-bg.gif"> <div align="center">{thumb2}</div></td> <td width="10"> </td> <td width='180' background="./images/thumb-bg.gif"> <div align="center">{thumb3}</div></td> <td width="10"> </td> <td width='180' background="./images/thumb-bg.gif"> <div align="center">{thumb4}</div></td> </tr> <tr valign="bottom"> <td height="3"></td> <td height="3"></td> <td height="3"></td> <td height="3"></td> <td height="3"></td> <td height="3"></td> <td height="3"></td> </tr> <!-- END block_thumb --> </table> <br> <img src="images/spacer.gif"></td> </tr> </table> {footer}
  4. For SEO purposes, I need to have a different header for the different portfolio pages generated on the following site: The primary page http://tcnyc.com/portfolio.php invokes the following, based on vf_category: http://tcnyc.com/por...egory=Bathrooms http://tcnyc.com/por...tegory=Kitchens The code at portfolio_category.php uses the following to set the header: //Show header $template_header = new HTML_Template_IT(); $template_header->loadTemplateFile("parts/header.tpl",true,false); $template_body->setVariable('header', $template_header->get()); The problem is the 2nd item, where parts/header.tpl is fixed. I need to use Bathroomsheader.tpl for bathrooms, Kitchensheader.tpl for kitchens, etc. (or some similar nomenclature). This is because the header (with Title & Description tags) needs to change based on category. The existing code is: <?php $vc_root_friendly = '.'; $vc_root_site = '.'; include_once("$vc_root_site/config.php"); include_once("$vc_includes_folder/IT.php"); $template_body = new HTML_Template_IT(); $template_body->loadTemplateFile("tpl_portfolio_category.html"); include_once("$vc_includes_folder/images.php"); if(!isset($_REQUEST['vf_category'])){ header("location:portfolio.php"); die(); } //Show header $template_header = new HTML_Template_IT(); $template_header->loadTemplateFile("parts/header.tpl",true,false); $template_body->setVariable('header', $template_header->get()); //Show footer $template_footer = new HTML_Template_IT(); $template_footer->loadTemplateFile("parts/footer.tpl",true,false); $template_body->setVariable('footer', $template_footer->get()); $template_body->setVariable("image_category", $_REQUEST['vf_category']); //Select photos for this category $vl_photos = $DB->q("SELECT * FROM $vc_prefix"."photo_gallery WHERE category = '$_REQUEST[vf_category]' ORDER BY id_photo"); //Show photos etc. Does anyone know how to modify this code such that the vf_category pulled from the database can cause includes of the correct header.tpl? I know that it will involve if & else commands, i.e., if vf_category = Bathrooms, then use header name A, else use head name B, etc. Thanks in advance! gckmac
  5. I tried to send you a PM with my AIM and Skype address. If you can help, great. Thx, gckmac
  6. Here is the code with Insertion ... the <select id=...> code just takes over: <select id="scampcity" name="scampcity"> <option value="-1">Select City...</option> <?php $query = "select distinct(city) from maine_hotels where city <> '' and state = 'Maine' and type = 'Vacation Rental' order by city "; $result = mysql_query($query, $link); while ($row = mysql_fetch_assoc($result)) { extract($row); echo "<option value = '$city'"; if ($city == $gcity) echo " selected "; echo ">$city</option>\n" ; } ?> </select> <input type="button" name="campcitychange" id="campcitychange" value="Go" /> <?php echo '<hr />'; ?> <?php mysql_data_seek($result, 0);//go back to first records while ($row = mysql_fetch_assoc($result)) { extract($row); ...
  7. I inserted the reset pointer function. It still mucks up the code below. The result looks like this, meaning that the drop list of cities becomes all that appears in the center box, rather than the specific city result. All Lodging in Newry: Bed & Breakfasts (All Maine) | Campgrounds (All Maine) | Hotels (All Maine) | Vacation Rentals (All Maine) Greenville, Phone: Map + Directions | Report Error Newry, Phone: Map + Directions | Report Error Raymond, Phone: Map + Directions | Report Error This beats me! gckmac
  8. I have some php code that works just fine. It queries the database and outputs the results (e.g., a list of vacation rentals). However, when I insert new php code above the working code - and the new code also queries the database - it screws up the working code. So basically I think I need some sort of "reset" function. To see functionality go to, e.g., www.maine.info/cities/newry/vacation_rentals.php. On the far right side of that page is a drop down box that I want to move to the center of the page, meaning that it comes before the php code that populates the page. Here is the code that I want to move from the right and insert to the top center: <select id="scampcity" name="scampcity"> <option value="-1">Select City...</option> <?php $query = "select distinct(city) from maine_hotels where city <> '' and state = 'Maine' and type = 'Vacation Rental' order by city "; $result = mysql_query($query, $link); while ($row = mysql_fetch_assoc($result)) { extract($row); echo "<option value = '$city'"; if ($city == $gcity) echo " selected "; echo ">$city</option>\n" ; } ?> </select> <input type="button" name="campcitychange" id="campcitychange" value="Go" /> Here is the code that works UNTIL I insert the above code above it. Again, I think the issue is so somehow cause a reset before invoking the below code: <?php while ($row = mysql_fetch_assoc($result)) { extract($row); if ($highRate != "" && $lowRate != "") { $range = " Range $" . $highRate . " to $" . $lowRate; } else { $range = ""; } $booking = (substr(trim($bookingurl), 0, 7) != "http://")? "" : "<a href = '$bookingurl' >$bookingtext</a> | "; /* if (substr($imageurl, 0, 7) != "http://") { $imageurl = "http://" . $imageurl; } */ $description = (trim($propertyDescription) == "") ? "": "<p><strong>Description</strong>: $propertyDescription</p>"; $namehtml = (substr(trim($linkurl), 0, 7) != "http://") ? "$name": "<a href = '$linkurl' >$name</a>"; $logo = (substr(trim($smlogo), 0, 7) != "http://") ? "": "<p class = 'propertylogo' style = 'float:right;'><img src = '$smlogo' width = '120px' height = '90' /></p> "; echo <<<ENT $logo <h2>$namehtml</h2> <p><font face="arial" size="2"> $address1 <br /> $city, $state $postalcode <br /> Phone: $phone1 <br /> $booking <a href = "http://www.maine.info/sandbox/maps/map2.php?type=001000000&city=$gcity&zoom=13">Map + Directions</a> </p> $description </font><hr /> ENT; } ?> Would appreciate any thoughts on this. Thanks!
  9. Thanks all. I will try working with these options and will report back early next week (have to travel this weekend). gckmac
  10. I need to preserve the data entered into form fields in case of failure of a captcha test (I am using recaptcha). The form <action> takes the user from form1.php to form2.php, which in turn returns the user to form1.php in case of captcha failure. Below is the code on www.maine.info/form1.php. Can anyone suggest how I can preserve the data in the fields on this form so the user does not have to reinput? <script type="text/javascript"> var RecaptchaOptions = { theme : 'clean' }; </script> <form action="form2.php" method="post"> <p>Your name: <input type="text" name="name" /></p> <p>Your age: <input type="text" name="age" /></p> <?php # Get the reCaptcha library require_once("captcha/recaptchalib.php"); $publickey = "xxxxxx"; echo recaptcha_get_html($publickey); ?> <p><input type="submit" /></p> </form> Thanks in advance, gckmac
  11. Solved it by using javascript instead of header() function. Code that works is as follows: <?php require_once("captcha/recaptchalib.php"); $privatekey = "6Le_LAYAAAAAAMAbcuBVpmqrrs0vN3alYZSYVt75"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); #if (!$resp->is_valid) { # // What happens when the CAPTCHA was entered incorrectly # die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . # "(reCAPTCHA said: " . $resp->error . ")"); if(!$resp->is_valid) { ?> <script> window.location.href='http://www.maine.info/apartments'; </script> <?php } else { // Your code here to handle a successful verification } ?>
  12. I have also tried the following to no avail: if(!$resp->is_valid) { header("Location: http://www.maine.info/apartments.php"); exit; It is as if the header() function does not work. gckmac
  13. Cannot get reCaptcha to redirect to a failure landing page. I am testing this at www.maine.info/form1.php ... which correctly goes to www.maine.info/form2.php The entire code on form2.php is below. The code within that section that fails to work (though suggested by many) is: if(!$resp->is_valid) { header("location:apartments.php"); die(); } The header thing does not work. Cannot get an error landing page to be invoked. THIS IS THE FULL PAGE CODE BELOW: <?php require_once("captcha/recaptchalib.php"); $privatekey = "xxxxx"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); #if (!$resp->is_valid) { # // What happens when the CAPTCHA was entered incorrectly # die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . # "(reCAPTCHA said: " . $resp->error . ")"); if(!$resp->is_valid) { header("location:apartments.php"); die(); } else { // Your code here to handle a successful verification } ?> <p><font face="arial"> Hi <?php echo htmlspecialchars($_POST['name']); ?>. You are <?php echo (int)$_POST['age']; ?> years old.</p></font> Thanks for your advice! gckmac
  14. So the problem is basically a failure to properly loop ... 1. If captcha is correct, I come back to the captcha form and dont' tell anyone AOK (though it does submit with correct database id). 2. If captcha is incorrect, I come back to the captcha form and lose the database event ID. So if user submits again, the event it applies to is unknown. I am learning php ... but too slowly. thx, gckmac
  15. Yes, I've added the process code (didn't show it before). I made progress rearranging the code. The remaining issue is that when wrong captcha is entered, the form forgets the event ID that went with it ... see code below ... <?php if ($type == "event") { $msg = "Thank you for updating our listing for <strong>$propertyname</strong>. We appreciate your time. Other folks will too."; } else { $msg = "Thank you for reporting an error in our listing for <strong>$propertyname</strong>. We appreciate your time. Other folks will too."; } ?> <p><?=$msg?></p> <form class="cmxform" id="signupform" method="post" action="reporterror.php"> <fieldset> <legend></legend> <p> <label for="msg">Describe Problem</label> <textarea id="msg" name="msg" cols="40" rows="10"></textarea> </p> <p> <label for="email">Email (Optional) </label> <input type="text" name="email" id="email" type="text" class="" /> <?php require_once("../captcha/recaptchalib.php"); $publickey = "6Le_LAYAAAAAAOuWVFAZzv-zRO_jN7km48LHHYEq"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <input type="submit" value="Submit" class="submit" id="signup" name="signup" /> </p> </fieldset> <input type = "hidden" id = "from_url" name = "from_url" value = "<?=$from_url ?>" /> <input type = "hidden" id = "propertyname" name = "propertyname" value = "<?=$propertyname ?>" /> </form> <?php if (isset($_POST['signup']) && $_POST['signup'] == "Submit") { require_once("../captcha/recaptchalib.php"); $privatekey = "xxxxxx"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } ?> <?php $msg = quote_smart($_POST['msg']); $email = quote_smart($_POST['email']); $from_url = $_POST['from_url']; $propertyname = $_POST['propertyname']; $subject = "Error Report about $propertyname"; $body = $msg; if ($email != "") { $body .= "\n Reported by $email"; } $body .= "\nURL: $from_url"; $headers = 'From: report.error@maine.info' . "\r\n"; mail("gckorn@gmail.com", $subject, $body, $headers); header("Location: $from_url"); } ?>
×
×
  • 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.