PHP - Moved: Sortable Width
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=351866.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=354118.0 I want visitors to be able to sort the results on my Browse Documentaries page by popularity, date, and type. The only way I know how to do this is to create a separate page for each sorting arrangement and provide a link to each page. Is there any way of doing it on a single page?
I am guessing that I can do things like that with Javascript or jQuery. Is that correct?
Hi All,
Am sure this is simple but can't work it out. I have the following which creates 3 menus:
<p>Drag items from one menu to another</p> <table> <tr> <td valign="top">Menu 1</td> <td valign="top">Menu 2</td> <td valign="top">Menu 3</td> </tr> <tr> <td valign="top"> <ul class="sortable" id="menu1"> <li id="id_1">Item 1</li> <li id="id_2">Item 2</li> </ul> </td> <td valign="top"> <ul class="sortable" id="menu2"> <li id="id_3">Item 3</li> <li id="id_4">Item 4</li> </ul> </td> <td valign="top"> <ul class="sortable" id="menu3"> <li id="id_5">Item 5</li> <li id="id_6">Item 6</li> </ul> </td> </tr> </table>This uses the following to show an array of each menu: $(function() { $("ul.sortable").sortable({ connectWith: '.sortable', update: function(event, ui) { $('#menu_choice').empty().html( $('.sortable').serial() ); } }); }); (function($) { $.fn.serial = function() { var array = []; var $elem = $(this); $elem.each(function(i) { var menu = this.id; $('li', this).each(function(e) { array.push( menu + '['+e+']=' + this.id ); }); }); return array.join('&'); } })(jQuery);What I'd like is to simply grab the values of menu 1 only, as the array shows all menus. What am I doing wrong as can't seem to just return menu1. Going forward, I then want to store the returned array into a PHP cookie if this is possible? Many thanks Hi, I have a page where users can add some text and additionally images. This is done through a textbox and NicEditor. Users are able to add images with any size, by either uploading it or usea URL. The problem occurs when they add a image wider than 560px, because then it ruins my lay out. This is why i want to add style="max-width:560px;" at the end of all image tags. So for example Code: [Select] <img src="http://images.com/image.jpg" style="max-width:560px;"> If made the following code but this only works when a user adds just one image, i need it to work also when there are multiple images. Code: [Select] <?php $img = '<img src="http://images.com/image.jpg">'; $imgstart = strpos($img,'<img'); // get position of <img if($imgpstart !== false) { $imgend = strpos($img,'>'); // get position of > $width = ' style="max-width:560px;">'; $img= substr_replace($img, $width, $imgend, 1); // replace > with $width } echo $img; ?> This may not be the safest and best solution so i'd like some help with a function which finds all images in a string and give them a max-width. thanks! Hi there. How can i set up a maximum width and height of a picture? For example: the limit is 400x400. So if the photo is 200x200 then it stays that way, however if a photo is 550x550 then it gets resized to 400x400. Hello I need help with a width issue I made a addnews page and it all works great but on my main page the widths limits are pretty short 200px and everytime i post something it exceeds that and screws up the website can you help where do I add the limits? on the front page coding? <? include("*****.inc"); $getnews = mysql_query("select * from news ORDER BY id DESC LIMIT 1 "); while($r=mysql_fetch_array($getnews)){ extract($r); echo("<p><b><i>$title <br/> $date</p></b></i>$news<br><br><br><br>"); } ?> The addnews? Code: [Select] <form action="submit.php" method="post"> <b>Title</b> <BR /> <input type="text" name="title" size="40" maxlength="80" value="Enter Title Here" /> <br /> <br /> <b>News</b><BR><textarea rows="5" cols="40" name="news" id="news" onKeyDown="textCounter(this,'progressbar1',150)" onKeyUp="textCounter(this,'progressbar1',150)" onFocus="textCounter(this,'progressbar1',150)"></textarea><br /> <div id="progressbar1" class="progress"></div> <script>textCounter(document.getElementById("maxcharfield"),"progressbar1",150)</script> <br /> <br /> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </form> or in the submitt file <? //grabs the variables $news = $_POST["news"]; $title = $_POST["title"]; //gets mysql info include("******.inc"); //gets the current date... $date = date("m/d/Y h:i A"); $addnews =MYSQL_QUERY("INSERT INTO news (id,title,date,news)". "VALUES ('NULL', '$title', '$date', '$news')"); //success... echo(""); ?> Thank for the help is there a way to get the $image width?... the $image is not on my server so i cant use getimagesize().. e.g. $image = http://www.example.com/picture.jpg how do i get the width? hello, lets say i want 3 of the following columns to only display on 1 line always, is there a way to do that? Code: [Select] <th align='center'>Date</th> <th align='center'>Supplier</th> <th align='center'>Requested By</th> <th align='center'>Address of Job</th> <th align='center'>Job Number</th> <th align='center'>P.O. Number</th> <th align='center'>Description</th> <th align='center'>Amount</th> <th align='center'>Notes</th> <th align='center'></th> is there a way to make the column width to try not have multiple lines if possible when pulling 200 rows from a database? i am uploading image to s3 server and by php i am making a copy of that image on server , if i upload an image of 2.3 mb than the width of image is not coming but if i upload less size image like 26kb than it is showing the width of image so it is able to create the copy . here is my code of php : $s3 = new S3(awsAccessKey, awsSecretKey); $thumbId = uniqid(); $thumbId .= ".jpg"; $img = ''; if($imgType == "image/jpeg"){ $img = imagecreatefromjpeg($sourceUrl); }else if($imgType == "image/png"){ $img = imagecreatefrompng($sourceUrl); }else if($imgType == "image/gif"){ $img = imagecreatefromgif($sourceUrl); }else{ $img = imagejpeg($sourceUrl); } echo $width = imagesx( $img ); echo $height = imagesy( $img ); please tell me what is the problem with size of image.. regards rahul I need to set the width and let height adjust to the proportions of width. Can someone please help me with this? I understand that $canvas_height should be 160, but then the image will crop to whichever side is greatest not by the width only. Code: [Select] <?php $img = "image.jpg"; $canvas_width = 160; $canvas_height = 0; list($img_width, $img_height) = getimagesize($img); $ratio_orig = $img_width / $img_height; if($canvas_width / $canvas_height > $ratio_orig) { $canvas_width = $canvas_height * $ratio_orig; } else { $canvas_height = $canvas_width / $ratio_orig; } $original = imagecreatefromjpeg($img); $canvas = imagecreatetruecolor($canvas_width, $canvas_height); imagecopyresampled($canvas, $original, 0, 0, 0, 0, $canvas_width, $canvas_height, $img_width, $img_height); $dest = "medium/image.jpg"; imagejpeg($canvas, $dest, 100); ?> Hi, ok so i have just created a form in HTML and am having the following problem in CSS
This is what the form looks like: http://gyazo.com/0aa...0dcf8f30efe4f9d
Now you can see that the width is covering the page each side
How can i fix this? for both width and height?
Here is my code:
#form { background-color: #111; margin: 0; text-align: center; padding: 15px; width: auto; height: auto; color: yellow; } #form input { border: 2px solid #ff0000; color: #ff0000; } Hi Guys
I am using media queries to set a different CSS if a mobile device. I am using 100% width on certain containers but the styling is using 100% based on the landscape orientation and not whichever way the device is being displayed.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
.slicknav_menu{
visibility:visible; i think that z-index is not solution if you look http://www.radio-la.info if z-index is 1 or more, banner go over web page (bouth), if z-index is 0 or lower, i cann not click on banner, i see only picture from left and right side of web page, available for a click now, is logical to have z-index on bouth div (banner) value 1 or mor but, how to count widhth of the banner, (now width of banner is 25% the left is z-index:0; right is z-index:1;) width = free white space from left or right side of web page thanks Hi People. Thanks for all the help on here in the past, you have been brilliant. I run the airfield cards.com website and have a script in the output page that is as follows. Code: [Select] To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>"> Now the way it shows on the site is like this Code: [Select] <iframe src='http://www.airfieldcards.com/php/courtesy_card.php?id=165' ></iframe> So, I look at the iframe code from google that should be cut and pasted into a website (obviously it's working code from google) Code: [Select] <iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&output=embed"></iframe><br /><small>View <a href="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&source=embed" style="color:#0000FF;text-align:left">AirfieldCards.com</a> in a larger map</small> Now I have tried to take the code from the google iframe (width/height/scrolling/etc) and paste it into my source but it doesn't work. Here's how I have done it. Code: [Select] To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>"> Can someone please modify my fist lot of code so that I have the correct height and width settings (700 x 1500) Thanks in advance Regards Vince Gledhill Hi Fellas, having a bit of a brain freeze here, i am trying to set a max width or height for a uploaded image, but my brain has frozen, maybe its the cold weather lol list($width,$height)=getimagesize($uploadedfile); $newwidth=250; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); basicly i want to find the biggest size of an image, beit width or height then set that size to 250... Any pointers here? hey guys thanks for the upcoming support how do I set the blue to fill up the remaining width of the while maininfo div? I tried setting the width:auto <div class="maininfo"> <div class="large">2</div> <div class="smallblock"> <div class="smalltop">3</div> <div class="small">4</div> </div> <div class="smallblock"> <div class="smalltop">5</div> <div class="small">6</div> </div> </div> .maininfo { width: 600px; } .large { float: left; height: 95px; background-color: blue; width:auto; } .smallblock { float: right; height: 90px; margin: 0 0 0 5px; width: 20%; } .small { background-color: red; height: 50%; width: 100%; } .smalltop { background-color: red; height: 50%; width: 100%; margin-bottom:5px; }Edit fiddle - JSFiddle how do i set the scrolll width of the page in the iframe, so i can scroll horizontally in the iframe? Code: [Select] <Iframe src="test.php?search=<?php echo $search; ?>" width="900px" height="600px"></Iframe> this sets the iframe perimeter size, but i want the inner size to be much bigger. maybe a better question is how to increase page size of test.php Hi folks, I'm using this code to display a picture that is uploaded in a form. Code: [Select] print "<img src='http://www.coast2kosci.com/mylongrun/test/photo_uploads/$imgx' width='300' height='300' alt='Your photo' />"; At first I tried specifying only the width, without the height. But for tall photos, the display wasn't really what I was after. Then I specified both width and height, which results in a mis-scaled photo. Is there any way that I can specify the height and width atributes as a sort of maximum / or limiter. Ie: If the height is greater than the width, limit the height to 300, and if the width is greater than the height, limit the width to 300? Thanks for your time, Dave Ok, first off CSS is definitely not my strong suit so bear with me here. This is my code:
<style media="screen" type="text/css"> /* <!-- */ .clear{ clear:both; } #grid{ width: 100%; } .grid-element{ width:33%; float:left; } a.clickable-div { display: block; height: 100%; width: 100%; text-decoration: none; } .img { height:auto; width:inherit; max-height:100%; max-width:100%; } .button { color: #900; font-weight: bold; font-size: 150%; text-transform: uppercase; display: block; width: 50%; } /* --> */ </style> <div id="grid"><div class="grid-element" align="center"> <img src="images/light_offline.png" class="img"> <p><h1>Hue Lamp 1 </h1></div><div class="grid-element" align="center"> <a href="action.php?light=2&state=false"> <img src="images/light_off.png" class="img"></a> <p><h1>Hue Lamp 2 </h1></div><div class="grid-element" align="center"> <a href="action.php?light=3&state=false"> <img src="images/light_off.png" class="img"></a> <p><h1>Hue Lamp 3 </h1></div></div><p> <div align="center"> <form method="POST" action="action.php"> <input type="hidden" name="scene" value="02b12e930-off-0"> <input type="submit" value="Scene 1" class="button"> </form> <p><form method="POST" action="action.php"> <input type="hidden" name="off"> <input type="submit" value="All Off" class="button"> </form> </div>This is the browser output. A couple things are wrong: 1. Why aren't the images scaling so they are all the same size? I assigned the same CSS class to each of the images but they are all appearing differently. The original images are all the same size. 2. Why are my buttons in the far right corner? I want to have them centered below the images so as to prevent the horizontal scroll bar, which I hate. Attached Files output.png 232.09KB 0 downloads |