Jump to content

ll87

Member
  • Posts

    36
  • Joined

  • Last visited

ll87's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. duhhhh. thanks very much, got it sorted now. but in the interests of clean code, i just added "_cont" to end of the id of the main content divs. can i ask about your solution? the $(this).attr('href') would return '#' right now yes? so are u saying it should give the href the value of the div we want to fade in. that way im only using the ID on the div and not on the navigation? thanks again
  2. sorry, there was a full stop after the url
  3. It's working in Chrome, Firefox, and Safari and IE8. http://mymediaventure.com/pricing.php clicking the options on the left fades out the content but the next div does not fade in. Can anyone help? Alex
  4. the only thing against setting them to display:none is that people with javascript turned off (i dont know anyone who does this) won't see them at all.
  5. I have implemented an image fader using jQuery but on first load, you briefly see the 4 images load on top of each other. i have tried to hide the images with regular javascript rather than wait until document ready but i can't track down how to solve this. can i actually get rid of this? if u need the url to see, i completely understand and i can send it to u but not on a forum post. i know i might have been vague but i think it's almost certainly a common problem Thanks!
  6. yea i initially had < but that wasnt working so i changed it. strangely enough i altered it a lot to play around, and then got rid of it all, and now its working with what i posted about. hours wasted for nothing. it's really strange. my friend told me about mysql_insert_id() and its definitely the better way to go
  7. I have the following query code. I insert a record and then do a select to retrieve it. The select is working as I can see it in my DB. Mysql_num_rows gives me a result of 1 which is correct. When i try to retrieve the data using mysql_fetch_array within a for loop, it says the values of id and title are empty which doesn't make sense. I thought it was to do with my query but seeing as the result of num_rows is correct it can't be. I'm stumped :s. $insert = mysql_query('INSERT INTO blog (title,entry) VALUES ("'.$blog_title.'","'.$blog_entry.'")') or die("Error:".mysql_error()); $new_result = mysql_query('SELECT id,title,entry FROM blog WHERE title="'.$blog_title.'" AND entry="'.$blog_entry.'"') or die("Error1:".mysql_error()); echo $new_rows = mysql_num_rows($new_result) or die(mysql_error()); for($i=0;$i<=$new_rows;$i++){ $row = mysql_fetch_array($new_result) or die(mysql_error()); $id = $row['id']; $title = $row['title']; $title = str_replace(" ","_",$title); header('Location: blog.php?title='.$title.'&id='.$id); }
  8. I am using array_slice in PHP to hold 12 elements, as there are 12 images per page on my site. However, now that I have moved over to this method, I can no longer see whether or not there are any images remaining and therefore whether there should be a Next hyperlink. Before i was using readdir and the pointer was always on the next image so it was easy, but now that i am putting all images into one array in one go, i can no longer do it this way. any help? if($skip != 0){ $has_previous = true; } while(($file = readdir($handle)) != false){ //read in all files. $extension = strtolower(substr(strrchr($file, '.'), 1)); //Read string after the . and get substring from the . if($file != '.' || $file != '..'){ if($extension == 'jpg' || $extension == 'jpeg' || $extension == 'JPG'){ $all_images[] = $file; //add file to array. } } } sort($all_images); //sort array alphabetically. $photos = array_slice($all_images,$skip,$per_page); //contains 12 images for each page, in order. //code here to process images. basically i only need the last array slice and then i can get the last element and say if there are any images left, if not dont add a Next link. sample gallery at www.alexbarron.co.uk/galleries.php?trip=Leaving_do
  9. thank you BeeDev, works in Chrome for OS X too. also, i notice when the div slides down, they shift to the left slightly, and when they are hidden they go back to the right.
  10. hey guys, i am working on a site for my friend, and the slideUp/down and fade ins and outs arent working properly, they are a bit jumpy. when a section slides down, it keeps sliding then when finished the bottom jumps up to where it should be. it's the same when i try fading. is it somethng to do with their containers? i haven't got fixed heights so i didn't think so. www.matthewmortimer.co.uk/photography.html is the address. jquery: $(document).ready(function(){ var h3; $("div.image_set").css("display","none"); if($("h3.trigger").length > 0){ $("h3.trigger").click(function(){ if($(this).hasClass("open")){ $(this).removeClass("open"); $(this).next().stop().slideDown(4000); $(".close").next().fadeOut(1000); $(this).addClass("close"); } else{ $(this).removeClass("close"); $(this).addClass("open"); $(this).next().stop().fadeOut(1000); } }) $("h3.trigger").hover(function(){ $(this).css("cursor","pointer"); h3 = $(this).html(); $(this).html(h3+" (click to view/hide images)"); }, function(){ $(this).html(h3); }); } }); thanks in advance
  11. yea this is! today ive been trying to work out how to modify an existing pagination script for my image gallery. take a look at that if u need to quench your problem solving thirst
  12. I am using the script here: http://www.lateralcode.com/simple-php-gallery-pagination/ and trying to modify it so it works with my current image gallery (done differently to theirs) but after loading the first 12 images (first page), clicking on Next goes to page_no 1 but thats as far as it goes, and on page 1 (0 is the first) no pictures load. It's driving me nuts as i dont know which bit of code is messed up. can someone take a look? PHP (gallery_images.php): <?php $country = $_GET['trip']; $directory = 'Images/'.$country; //folder of gallery photos. $thumbs_dir = 'thumbs'; $_thumbs = "_thumb."; //to add to end of each thumbnail's name. $allowed_types = array('jpg','jpeg','gif','png'); $file_parts = array(); //consists of file name and extension. $title = ''; //First part of file parts. $ext = ''; //Second part of file parts. $i = 0; //Iterator to check for last (fourth) image in each row. $per_page = 12; $has_previous = false; $has_next = false; $page_no = $_GET['page_no']; //try to open directory. $dir_handle = opendir($directory) or die("Cannot open directory."); $count = 0; $skip = $page_no * $per_page; if($skip != 0){ $has_previous = true; } while($count < $skip && $file = readdir($dir_handle)) { if(!is_dir($file) && in_array($ext,$allowed_types)) { $count++; } } echo 'page number = '.$page_no; $count = 0; //while($count < $per_page && $file = readdir($dir_handle)) //{ // if(!is_dir($file) && in_array($ext,$allowed_types)){ // $count++; // } //} while($count <= $per_page && $file = readdir($dir_handle)) //Look through folder. { if($file == '.' || $file == '..') continue; //Ignore these files. $file_parts = explode('.',$file); //Split file into its parts and put into array. $ext = strtolower(array_pop($file_parts)); //Puts last item of array into ext. if(in_array($ext,$allowed_types)){ $title = implode('.',$file_parts); //ext has been popped off, so all that remains is title of file. $title = htmlspecialchars($title); //Make title html safe if it isn't already. //Create image to create thumbnail from. $img = imagecreatefromjpeg($directory.'/'.$file); $width = imagesx($img); $height = imagesy($img); //Create thumbnails. $new_width = 150; $new_height = floor($height * ($new_width / $width)); //Creates proportionally correct new height according to new width. floor rounds down to integer. //Create new image with new dimensions to hold thumb $tmp_img = imagecreatetruecolor($new_width,$new_height); //Copy and resize original image into new image. imagecopyresampled($tmp_img,$img,0,0,0,0,$new_width,$new_height,$width,$height); //Store image in a directory if(!is_dir($directory.'/'.$thumbs_dir)) { mkdir($directory.'/'.$thumbs_dir); } imagejpeg($tmp_img,$directory.'/'.$thumbs_dir.'/'.$title.$_thumbs.$ext); //echo '';//'; $nomargin = ''; //Variable for last image of each row. if(in_array($ext,$allowed_types)) //If file is an allowed file type. { //echo ' //'.$title.''; if(($i+1)%4==0) $nomargin = 'nomargin'; //i begins at 0 so add one to correspond to first image. If it is divisable by 4, it //the last of the row, so give special class of nomargin. echo ' '.$title.''; //echo ''; $i++; //Next iteration we are looking at next image. } } $count++; } while($file = readdir($dir_handle)) { if(!is_dir($file) && in_array($ext,$allowed_types)) { $has_next = true; break; } } closedir($dir_handle); //close the directory. ?> PHP (gallery_content.php): <?php include 'gallery_images.php'; ?> <?php if($has_previous){ echo 'Previous'; } if($has_next){ echo 'Next'; } ?>
×
×
  • Create New...