Jump to content

bravo14

Members
  • Posts

    296
  • Joined

  • Last visited

Everything posted by bravo14

  1. I need to find out if which page it is in the request_uri so I can set the language if there is no cookie set for it the request uri is [REQUEST_URI] => /notizie/1 I would be able to do it if is equal to, just need to know if there is a way I can do a contains?
  2. Hi guys I have a site that has different url rewrites based on the language e.g. News (English) notizie (Italian noticias (Spanish) how can I find out with php iwhich is set in the request_uri when it says [REQUEST_URI] => /notizie/1 Thanks
  3. Thanks, took a bit tweaking, but all done
  4. Don't want to sound stupid, how do you mean?
  5. I am trying to build some jQuery tabs using PHP & MySQL so it has the following layout <div id="tabs"> <ul> <li><a href="#tabs-1">Tab 1</a></li> <li><a href="#tabs-2">Tab 2</a></li> <li><a href="#tabs-3">Tab 3</a></li> </ul> <div id="tabs-1"> tab 3 content </div> <div id="tabs-2"> tab2 content </div> <div id="tabs-3"> tab3 content </div> </div> I can get the tabs, I just can't figure out the content <?php //get menu options from database $menus_sql=mysql_query("SELECT * FROM `tbl_menus`"); if(mysql_num_rows($menus_sql)>0){ echo('<ul>'); while($menus_row=(mysql_fetch_assoc($menus_sql)){ echo('<li><a href="#tabs-'.$menus_row['id'].'">'.$menus_row['menu_title'].'</a></li>'); } echo('</ul>'); } ?> Any idea how I can create the content The table has the following layout id menu_title menu_content
  6. bravo14

    List Height

    I am trying to produce a list of images with a height of 210px using the css below. However it doesn't seem to pick up the height. #sponsors ul{ list-style:none; } #sponsors li{ border:solid 3px #666666; width:210px; height:210px; background:url(../images/bg-sponsor.png); list-style:none; display:inline; vertical-align:middle; } #sponsors li img{ max-width:200px; border:none; } any ideas why?
  7. This is the code for the page <?php //include_once('includes/connect_inc.php'); if(isset($_COOKIE['lang'])){ if($_COOKIE['lang']=='it'){ include_once('includes/defines_it.php'); } else{ include_once('includes/defines_en.php'); } } else{ include_once('includes/defines_en.php'); } ?> <?php function auto_copyright($year = 'auto'){ ?> <?php if(intval($year) == 'auto'){ $year = date('Y'); } ?> <?php if(intval($year) == date('Y')){ echo intval($year); } ?> <?php if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } ?> <?php if(intval($year) > date('Y')){ echo date('Y'); } ?> <?php } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/covatti.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- InstanceBeginEditable name="doctitle" --> <title><?php echo site_title;?></title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="css/covatti.css" rel="stylesheet" type="text/css" /> </head> <body> <div align="center"> <div id="main-container"> <span id="top-nav"><?php include_once('includes/top-nav_inc.php');?></span> <table width="967" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" id="header"> <div id="header"> <img src="images/logo.png"> </div> </td> </tr> <tr> <td width="200"> </td> <td width="767"> </td> </tr> <tr id="main_content"> <td id="left-bar"><img src="images/nico.png" /><br /> <?php echo screen_resolution;?> <script type="text/javascript"> document.write(screen.width+'x'+screen.height); </script><br/> <?php if(isset($_COOKIE['lang'])){ if($_COOKIE['lang']=='it'){ ?> <a href="rss-it.php"> <?php } else{?> <a href="rss-en.php"> <?php } } else{?> <a href="rss-en.php"> <?php } ?> <img src="images/rss.png" /></a> </td> <td id="main-content"> <!-- InstanceBeginEditable name="main-content" --> <h1><?php echo contact;?></h1> <div align="center"> <form> <?php echo fromname;?><br /><input name="name" /><br /> <?php echo emailaddress;?><br /><input name="email" /><br /> <?php echo reason;?><br /> <select name="reason"> <option selected="selected"><?php echo pleaseselect;?>...</option> <option value="<?php echo sponsorrequest;?>"><?php echo sponsorrequest;?></option> <option value="<?php echo websiteproblem;?>"><?php echo websiteproblem;?></option> </select><br /> <?php echo message;?><br /> <textarea name="message"></textarea><br /> <?php echo humanquestion;?><br /><input name="human" /><br /><?php echo humanreason;?> </form> </div> <!-- InstanceEndEditable --> </td> </tr> <tr> <td id="footer" colspan="2"> <div id="footer-nav"><?php include_once('includes/footer-nav_inc.php');?></div><br /> </td></tr> <tr> <td id="footer" colspan="2"> <blockquote> <p>© <?php auto_copyright('2012'); ?> Covatti Racing</p> </blockquote> Website by <a href="http://www.bravo14.co.uk" target="_blank">Bravo14</a> </td> </tr> </table> </div> </div> </body> <!-- InstanceEnd --></html> The languages are coming from include files that contain a list of defines
  8. Hi I am developing a site that needs to be in 3 languages, English Italian and Spanish, the English is displayed correctly however when I change it to show Italian, some of the characters are not displayed correctly, for example the e with the accent at the top. How can I get the letters to display properly regardless of language selected?
  9. Hi guys Does anybody know of a free translator service that I can pass a form field to and receive the translated value back, I am writing a site for an Italian speedway riser and it will need to be in Italian and English as a minimum.
  10. Is there an easier way of doing it? I found this query on a tutorial
  11. Hi I have two tables tbl_users this holds all of the user data including latitude and longitude, and tbl_auction_lot this holds details of items available for auction. i am trying to write a query that displays all of the auction lots within a certain distance This will display the distance, however as soon as I put in * from both tabkes I get syntax errors SELECT ((ACOS(SIN(52.4564772 * PI() / 180) * SIN(latitude * PI() / 180) + COS(52.4564772 * PI() / 180) * COS(latitude * PI() / 180) * COS((-1.7675127 - longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS `distance` FROM `tbl_users` INNER JOIN `tbl_auction_lot` on `tbl_auction_lot`.`cust_id`=`tbl_users`.`cust_id` HAVING `distance`<='10' ORDER BY `distance` ASC How can I get other fields displayed, or is it case of listing the fields that I require, rather than * fields
  12. Hi I am defining a variable that contains commas e.g. "Manchester, United Kingdom" in the following way $location=$_POST['select']; However when I echo the variable, it only shows "Manchester," and ignores anything after the comma, how can I correct this? Probable really simple.
  13. Hi I cant see what is wrong with this but I am getting the error above <?php if(isset($post_id)){ echo ('<h1>'.$post['title'].'</h1>'.$post['content']); } else { //search all blog table $blog_sql=mysql_query("SELECT * FROM `tbl_blog` order by `post_date_time` desc") or die(mysql_error()); if(mysql_num_rows($blog_sql==0)){ //line 127 echo "There are no blog posts yet"; } else { echo('<table> <tr><td>Date</td><td>Intro</td></tr>'); while($blog_row=mysql_fetch_assoc($blog_sql)){ echo('<tr><td>'.$blog_row['datetime'].'</td><td>'.$blog_row['intro'].'</td></tr>'); } echo('</table>'); } } ?> The query generates a result with zero rows in the database,which is correct.
  14. I have a textarea that includes £ signs as a salary, this is added to the database up to £25k basic + car + benefits; OTE inc Commiss... When this is called from the database and displayed it is shown as follows up to �25k basic + car + benefits; OTE inc Commission up to �50k-�60k + How can I get it to display as html so the pound sign is set as £ Ideally I don't want to use WYSIWYG editor just the textarea.
  15. That works perfectly, however using the same layout to generate another dataset I am getting the following error Parse error: syntax error, unexpected T_VARIABLE in /home/sites/purelybooks.com/public_html/includes/best_sellers_inc.php on line 10 The code is <?php //category listing $best_sellers_file = "http://book.find-services.co.uk/bookSearch.aspx?site=purelybooks&category=newreleases&sort=popular&pagesize=10"; echo ('<div class="jcarousel-skin-name"> <div class="jcarousel-container"> <div class="jcarousel-clip"> <ul class="jcarousel-list">'); $best_sellers_xml = simplexml_load_file($best_sellers_file); foreach($best_sellers_xml->xpath('//book') as $best_sellers_book) { var_dump $best_sellers_book; echo ('<li class="jcarousel-item">'$best_sellers_book->title'</li>\n'); } echo('</ul> </div> </div> </div>'); ?> The xml file I am reading looks like <?xml version="1.0" encoding="UTF-8" standalone="true"?> -<books>-<book><id>0007466072</id><isbn13>9780007466078</isbn13><asin>0007466072</asin><title>A Song of Ice and Fire (5) - A Dance With Dragons: Part 2 After the Feast</title><numberOfPages>592</numberOfPages>-<authors><author>George R. R. Martin</author></authors><published>15 March 2012</published><review/><rrp>8.99</rrp><publisher>Harper Voyager</publisher><cover>Paperback</cover><imageURL>http://images-eu.amazon.com/images/P/0007466072.02.MZZZZZZZ.jpg</imageURL><thumbnailURL>http://images-eu.amazon.com/images/P/0007466072.02.THUMBZZZ.jpg</thumbnailURL><pricesLastCached>30/05/2012 05:06:10</pricesLastCached><minimumPrice>3.86</minimumPrice></book>-<book><id>0007466064</id><isbn13>9780007466061</isbn13><asin>0007466064</asin><title>A Song of Ice and Fire (5) - A Dance With Dragons: Part 1 Dreams and Dust</title><numberOfPages>704</numberOfPages>-<authors><author>George R. R. Martin</author></authors><published>15 March 2012</published><review/><rrp>8.99</rrp><publisher>Harper Voyager</publisher><cover>Paperback</cover><imageURL>http://images-eu.amazon.com/images/P/0007466064.02.MZZZZZZZ.jpg</imageURL><thumbnailURL>http://images-eu.amazon.com/images/P/0007466064.02.THUMBZZZ.jpg</thumbnailURL><pricesLastCached>29/05/2012 18:00:50</pricesLastCached><minimumPrice>3.86</minimumPrice></book>
  16. That shows the XML feed so at least I know it is getting the data, ultimately, what I want to do is compile a list with links in the following layout <li><"a href=category.php?xml id">xml category</a></li>
  17. Hi Guys I have an XML feed that produces the following data:- <?xml version="1.0" encoding="utf-8" standalone="yes" ?> - <bookCategories> - <category> <id>addressbooks</id> <name>Address Books & Journals</name> </category> - <category> <id>art</id> <name>Art, Architecture & Photography</name> </category> - <category> <id>audiocd</id> <name>Audio Books</name> </category> - <category> <id>audiocassette</id> <name>Audio Cassettes</name> </category> - <category> <id>bestsellers</id> <name>Best Sellers</name> </category> I want to list each of the category names I am using the code below: <?php //category listing $file="http://book.find-services.co.uk/bookCategories.aspx?site=Purelybooks"; $dom=new DOMdocument(); $dom->load($file); $xml=simplexml_import_dom($dom); echo $xml->category; ?> The categories are not showing at all, there are no errors being produced. Hopefully someone can give me some pointers in the right direction.
  18. I am making progress :-) I just have one error now and it is Warning: imagecopyresampled() expects parameter 2 to be resource, string given in C:\wamp\www\haldon\admin\upload.php on line 91 The offending line now says: imagecopyresampled($tmp,$filename,0,0,0,0,$newwidth,$newheight,$width,$height);
  19. I now have a series of errors showing, but I have a feeling that they are relate to the first one, the first error is Warning: getimagesize(60.jpg) [function.getimagesize]: failed to open stream: No such file or directory in C:\wamp\www\haldon\admin\upload.php on line 57 The entire page code is <?php error_reporting( E_ALL ); include("config.inc.php"); include('../includes/connect_inc.php'); // initialization $result_final = ""; $counter = 0; // List of our known photo types $known_photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png' ); // GD Function List $gd_function_suffix = array( 'image/pjpeg' => 'JPEG', 'image/jpeg' => 'JPEG', 'image/gif' => 'GIF', 'image/bmp' => 'WBMP', 'image/x-png' => 'PNG' ); // Fetch the photo array sent by add-photos.php $photos_uploaded = $_FILES['photo_filename']; // Fetch the photo caption array $photo_caption = $_POST['photo_caption']; while( $counter <= count($photos_uploaded) ) { if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) { $result_final .= "File ".($counter+1)." is not a photo<br />"; } else { mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" ); $new_id = mysql_insert_id(); $filetype = $photos_uploaded['type'][$counter]; $extention = $known_photo_types[$filetype]; $filename = $new_id.".".$extention; mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" ); //resize photos to maximum height or width //define parameters - maximum height & width for new images $image_max_width=599; $image_max_height=599; $max_dimension=800; // Grab the width and height of the image. list($width,$height) = getimagesize($filename); // If the max width input is greater than max height we base the new image off of that, otherwise we // use the max height input. // We get the other dimension by multiplying the quotient of the new width or height divided by // the old width or height. echo 'Line: ' . __LINE__ . '$image_max_width = ' . $image_max_width . '<br/>'; echo 'Line: ' . __LINE__ . '$image_max_height = ' . $image_max_height . '<br/>'; if($image_max_width > $image_max_height){ if($image_max_width > $max_dimension){ $newwidth = $max_dimension; } else { $newwidth = $image_max_width; } $newheight = ($newwidth / $width) * $height; } else { if($image_max_height > $max_dimension){ $newheight = $max_dimension; } else { $newheight = $image_max_height; } $newwidth = ($newheight / $height) * $width; } // Create temporary image file. $tmp = imagecreatetruecolor($newwidth,$newheight); // Copy the image to one with the new width and height. imagecopyresampled($tmp,$filename,0,0,0,0,$newwidth,$newheight,$width,$height); //end of resizing // Store the orignal file copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename); // Let's get the Thumbnail size $size = GetImageSize( $images_dir."/".$filename ); if($size[0] > $size[1]) { $thumbnail_width = 100; $thumbnail_height = (int)(100 * $size[1] / $size[0]); } else { $thumbnail_width = (int)(100 * $size[0] / $size[1]); $thumbnail_height = 100; } // Build Thumbnail with GD 1.x.x, you can use the other described methods too $function_suffix = $gd_function_suffix[$filetype]; $function_to_read = "ImageCreateFrom".$function_suffix; $function_to_write = "Image".$function_suffix; // Read the source file $source_handle = $function_to_read ( $images_dir."/".$filename ); if($source_handle) { // Let's create an blank image for the thumbnail $destination_handle = ImageCreate ( $thumbnail_width, $thumbnail_height ); // Now we resize it ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] ); } // Let's save the thumbnail $function_to_write( $destination_handle, $images_dir."/tb_".$filename ); ImageDestroy($destination_handle ); // $result_final .= "<img src='".$images_dir. "/tb_".$filename."' /> File ".($counter+1)." Added<br />"; } } $counter++; } //header('Location: add-photos.php'); // Print Result echo <<<__HTML_END <html> <head> <title>Photos uploaded</title> </head> <body> $result_final </body> </html> __HTML_END; ?>
  20. Psycho: I appreciate your feedback, if I am honest the page is a mashup of two tutorials, and I have tried to put it together as one. I have attached the two original pages, the upload.php allows multiple uploads, and add the images to the database, and the index.php allows for one image upload but also resizes them. MMDE: I will add the echos and see what I get come out. 18101_.php 18102_.php
  21. Hi I have added the error_reporting( E_ALL ); And I am still not getting any errors displayed, it is as if the code is being ignored
  22. Hi I am trying to resize images as they are uploaded. The problem I have is that the image is uploading and adding to the database, but is not resizing. The code I am using is below <?php include("config.inc.php"); include('../includes/connect_inc.php'); // initialization $result_final = ""; $counter = 0; // List of our known photo types $known_photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png' ); // GD Function List $gd_function_suffix = array( 'image/pjpeg' => 'JPEG', 'image/jpeg' => 'JPEG', 'image/gif' => 'GIF', 'image/bmp' => 'WBMP', 'image/x-png' => 'PNG' ); // Fetch the photo array sent by add-photos.php $photos_uploaded = $_FILES['photo_filename']; // Fetch the photo caption array $photo_caption = $_POST['photo_caption']; while( $counter <= count($photos_uploaded) ) { if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) { $result_final .= "File ".($counter+1)." is not a photo<br />"; } else { mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" ); $new_id = mysql_insert_id(); $filetype = $photos_uploaded['type'][$counter]; $extention = $known_photo_types[$filetype]; $filename = $new_id.".".$extention; mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" ); //resize photos to maximum height or width //define parameters - maximum height & width for new images $image_max_width=599; $image_max_height=599; $max_dimension=800; // Grab the width and height of the image. list($width,$height) = getimagesize($_FILES['photo_filename']); // If the max width input is greater than max height we base the new image off of that, otherwise we // use the max height input. // We get the other dimension by multiplying the quotient of the new width or height divided by // the old width or height. if($image_max_width > $image_max_height){ if($image_max_width > $max_dimension){ $newwidth = $max_dimension; } else { $newwidth = $image_max_width; } $newheight = ($newwidth / $width) * $height; } else { if($image_max_height > $max_dimension){ $newheight = $max_dimension; } else { $newheight = $image_max_height; } $newwidth = ($newheight / $height) * $width; } // Create temporary image file. $tmp = imagecreatetruecolor($newwidth,$newheight); // Copy the image to one with the new width and height. imagecopyresampled($tmp,$image,0,0,0,0,$newwidth,$newheight,$width,$height); //end of resizing // Store the orignal file copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename); // Let's get the Thumbnail size $size = GetImageSize( $images_dir."/".$filename ); if($size[0] > $size[1]) { $thumbnail_width = 100; $thumbnail_height = (int)(100 * $size[1] / $size[0]); } else { $thumbnail_width = (int)(100 * $size[0] / $size[1]); $thumbnail_height = 100; } // Build Thumbnail with GD 1.x.x, you can use the other described methods too $function_suffix = $gd_function_suffix[$filetype]; $function_to_read = "ImageCreateFrom".$function_suffix; $function_to_write = "Image".$function_suffix; // Read the source file $source_handle = $function_to_read ( $images_dir."/".$filename ); if($source_handle) { // Let's create an blank image for the thumbnail $destination_handle = ImageCreate ( $thumbnail_width, $thumbnail_height ); // Now we resize it ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] ); } // Let's save the thumbnail $function_to_write( $destination_handle, $images_dir."/tb_".$filename ); ImageDestroy($destination_handle ); // $result_final .= "<img src='".$images_dir. "/tb_".$filename."' /> File ".($counter+1)." Added<br />"; } } $counter++; } header('Location: add-photos.php'); // Print Result echo <<<__HTML_END <html> <head> <title>Photos uploaded</title> </head> <body> $result_final </body> </html> __HTML_END; ?> Any help would be appreciated.
  23. Hi I am trying to create a draggable list of items, the code is below Jquery set up <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <link href="style/admin.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/> <link rel="stylesheet" href="css/template.css" type="text/css"/> <script src="js/jquery-1.6.min.js" type="text/javascript"> </script> <script src="js/jquery-ui-1.8.16.custom.min.js"></script> <script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"> </script> <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"> </script> <script src="js/contrib/other-validations.js" type="text/javascript" charset="utf-8"> </script> <link rel="stylesheet" href="style/jquery.ui.all.css"> <script src="js/jquery.ui.core.js"></script> <script src="js/jquery.ui.widget.js"></script> <script src="js/jquery.ui.datepicker.js"></script> <script src="js/jquery.ui.accordion.js"></script> <script src="js/jquery.ui.sortable.js"></script> <script> $(document).ready(function() { $("#accordion").accordion(); }); </script> <script> $(document).ready( function() { $("#sortme").sortable({ update : function () { serial = $('#sortme').sortable('serialize'); $.ajax({ url: "sort-events.php", type: "post", data: serial, error: function(){ alert("theres an error with AJAX"); } }); } }); } ); </script> List of items <ul id="sortme"> <li id="menu_16">31st March - Steam train starts operating from Paignton to Dartmouth</li> <li id="menu_15">31st March - 15th April - Easter Fun Fair Paignton</li> <li id="menu_14">24th - 25th March Half price steam train rides on the Buckfastleigh/Totnes Line</li> <li id="menu_17">6th - 8th April - Paignton Rugby Club Beer Festival</li> </ul> When I go to the page, the items are not sortable/draggable What have I done wrong?
×
×
  • 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.