
gckmac
Members-
Posts
25 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
gckmac's Achievements

Newbie (1/5)
0
Reputation
-
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.
-
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.
-
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}
-
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
-
I tried to send you a PM with my AIM and Skype address. If you can help, great. Thx, gckmac
-
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); ...
-
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
-
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!
-
Thanks all. I will try working with these options and will report back early next week (have to travel this weekend). gckmac
-
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
-
[SOLVED] reCaptcha - redirected landing page upon failure
gckmac replied to gckmac's topic in PHP Coding Help
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 } ?> -
[SOLVED] reCaptcha - redirected landing page upon failure
gckmac replied to gckmac's topic in PHP Coding Help
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 -
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