• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
Thank you, both.
[QUOTE=Sentinel010;40616603]Hi, I'm trying to position one icon next to another But it doesn't seem to move up Here's screenshot [IMG]http://i.imgur.com/xfp0fZq.png[/IMG] Here's code [url]http://jsfiddle.net/UDmmE/[/url][/QUOTE] I forked that fiddle and modified it a little bit. I think it represents what you want to achieve. [url]http://jsfiddle.net/LQkzR/1/[/url] [editline]12th May 2013[/editline] Oh snap, I was ninja'd.
[QUOTE=Worre;40616783]I forked that fiddle and modified it a little bit. I think it represents what you want to achieve. [url]http://jsfiddle.net/LQkzR/1/[/url] [editline]12th May 2013[/editline] Oh snap, I was ninja'd.[/QUOTE] Haha yeah, but I learned a neat little trick from you, I can edit two ID's at once :)
[QUOTE=Sentinel010;40616816]Haha yeah, but I learned a neat little trick from you, I can edit two ID's at once :)[/QUOTE] Or you could use a class.
[QUOTE=Sentinel010;40616816]Haha yeah, but I learned a neat little trick from you, I can edit two ID's at once :)[/QUOTE] Not to be mean or anything but scooby did that also
Does anyone have any experience with Devise and Paperclip for Rails 4? Rails 4 they removed the attr_accessible in your model for a controller, so I'm not sure how I'd go about allowing :avatar to be accessed when I'm using Devise's controller (hidden, behind the scenes). [editline]12th May 2013[/editline] I'm almost positive I just need something to tell Rails to allow :avatar
Is it possible to code in HTML something like a random link selector? Or more certain a random YouTube video? Something that would randomise from 1-17 iframes and would show only it.
[QUOTE=B-Rabbit;40632397]Is it possible to code in HTML something like a random link selector? Or more certain a random YouTube video? Something that would randomise from 1-17 iframes and would show only it.[/QUOTE] You need another language to randomize it, either clientside (Javascript) or serverside (PHP, Ruby, etc.)
[QUOTE=B-Rabbit;40632397]Is it possible to code in HTML something like a random link selector? Or more certain a random YouTube video? Something that would randomise from 1-17 iframes and would show only it.[/QUOTE] HTML is static, so it would be impossible without any other language.
[QUOTE=B-Rabbit;40632397]Is it possible to code in HTML something like a random link selector? Or more certain a random YouTube video? Something that would randomise from 1-17 iframes and would show only it.[/QUOTE] Very basic in php. (I hope it makes sense.) [PHP] $one = "<iframe width='560' height='315' src='http://www.youtube.com/embed/u0l4HMJdSf4' frameborder='0' allowfullscreen></iframe>"; $two = "<iframe width='560' height='315' src='http://www.youtube.com/embed/x1tPGXwSaZo' frameborder='0' allowfullscreen></iframe>"; $three = "<iframe width='560' height='315' src='http://www.youtube.com/embed/zJ_2NTthBnU' frameborder='0' allowfullscreen></iframe>"; $array = array($one,$two,$three); $rand = array_rand($array,1); echo $array[$rand]; [/PHP]
Although when you want 17 frames maybe this is easier to maintain: (Thanks to gokiyono for the basis) [code] <?php $pre = "<iframe width='560' height='315' src='http://www.youtube.com/embed/"; $pst = "' frameborder='0' allowfullscreen></iframe>"; $array = array("u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4"); //etc $rand = array_rand($array, 1); echo $pre. $array[$rand]. $pst; ?> [/code] Just place the rest of the html around it. [editline]14th May 2013[/editline] And all you need to do to add more video's is place the id (at the end of the url) in the array as in the example.
[QUOTE=eternalflamez;40638175]Although when you want 17 frames maybe this is easier to maintain: (Thanks to gokiyono for the basis) [code] <?php $pre = "<iframe width='560' height='315' src='http://www.youtube.com/embed/"; $pst = "' frameborder='0' allowfullscreen></iframe>" $array = array("u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4", "u0l4HMJdSf4"); //etc $rand = array_rand($array, 1); echo $pre. $array[$rand]. $pst; ?> [/code] Just place the rest of the html around it.[/QUOTE] I thought about doing something like that, I just had no idea how I would go by. Don't mind me, I'm just saving this for later. //Thank you is what I'm trying to say
I am trying to runa MYSQL query which selects different entries. I am trying only grab certain entries with a specific ID. I have string which is equal to [PHP]OR `id` = 'id' OR `id` = 'id2'[/PHP] etc How can i append this to a mysql query which is [PHP] $getmastchio = mysql_query("SELECT * FROM `mastchio` WHERE `author` = '$user_data[username]' {INSERT OR'S HERE} ORDER BY `id` DESC LIMIT 25"); while($mastchio = mysql_fetch_array($getmastchio)) { [/PHP] Thanks BoshuaJackman
[QUOTE=TehWhale;40621367]Does anyone have any experience with Devise and Paperclip for Rails 4? Rails 4 they removed the attr_accessible in your model for a controller, so I'm not sure how I'd go about allowing :avatar to be accessed when I'm using Devise's controller (hidden, behind the scenes). [editline]12th May 2013[/editline] I'm almost positive I just need something to tell Rails to allow :avatar[/QUOTE] You do this at the controller level now, haven't played around with rails 4 yet, but if you look for "what's new in rails 4" type posts you should be able to see how it works.
[QUOTE=boshuajackman;40643979]I am trying to runa MYSQL query which selects different entries. I am trying only grab certain entries with a specific ID. I have string which is equal to [PHP]OR `id` = 'id' OR `id` = 'id2'[/PHP] etc How can i append this to a mysql query which is [PHP] $getmastchio = mysql_query("SELECT * FROM `mastchio` WHERE `author` = '$user_data[username]' {INSERT OR'S HERE} ORDER BY `id` DESC LIMIT 25"); while($mastchio = mysql_fetch_array($getmastchio)) { [/PHP] Thanks BoshuaJackman[/QUOTE] Uhm, okay: [php] $ors = "OR `id` = 'id' OR `id` = 'id2'"; $getmastchio = mysql_query("SELECT * FROM `mastchio` WHERE `author` = '$user_data[username]' $ors ORDER BY `id` DESC LIMIT 25"); while($mastchio = mysql_fetch_array($getmastchio)) { [/php] Also, did you know using php's mysql_* functions is not recommended? They are deprecated, and you should us mysqli or pdo instead. Mainly because of security, but in a while they'll remove the mysql_* functions and then your website won't work anymore. (Note, might take a few years :v:)
Also, do this instead of the OR id=x OR id=y [code] WHERE id IN ('$id1', '$id2', '$id3') [/code]
[QUOTE=eternalflamez;40644300]Uhm, okay: [php] $ors = "OR `id` = 'id' OR `id` = 'id2'"; $getmastchio = mysql_query("SELECT * FROM `mastchio` WHERE `author` = '$user_data[username]' $ors ORDER BY `id` DESC LIMIT 25"); while($mastchio = mysql_fetch_array($getmastchio)) { [/php] Also, did you know using php's mysql_* functions is not recommended? They are deprecated, and you should us mysqli or pdo instead. Mainly because of security, but in a while they'll remove the mysql_* functions and then your website won't work anymore. (Note, might take a few years :v:)[/QUOTE] Doesn't seem to be working. PHP: [PHP] $getmastchio = mysql_query("SELECT * FROM `mastchio` WHERE `author` = '$user_data[username]' $following ORDER BY `id` DESC LIMIT 25"); while($mastchio = mysql_fetch_array($getmastchio)) {[/PHP] Error/$following [IMG]http://i.imgur.com/bwLzPYF.png[/IMG]
[QUOTE=boshuajackman;40655835]Doesn't seem to be working. PHP: [PHP] $getmastchio = mysql_query("SELECT * FROM `mastchio` WHERE `author` = '$user_data[username]' $following ORDER BY `id` DESC LIMIT 25"); while($mastchio = mysql_fetch_array($getmastchio)) {[/PHP] Error/$following [IMG]http://i.imgur.com/bwLzPYF.png[/IMG][/QUOTE] Well, that means the query itself failed. Around the while, place this: [php] if($getmastchio) { while etc... } else{ echo "Error in query :( ". mysql_error(); } [/php] I can already guess what the error is though. Wrong quotations around the variable names. `author`=`fran` is wrong, needs to be `author`='fran' Notice the difference? `` <-- marks a table or field name, '' <-- marks a variable
So I was wondering if I would end up on a list for using element.class instead of just .class?
For the 404 page on my site I wanted to have randomized images (think of 4chan), problem is: I have no idea how to do that. Could anyone show me how this is done? Thanks.
[QUOTE=DrunkOtter;40662903]For the 404 page on my site I wanted to have randomized images (think of 4chan), problem is: I have no idea how to do that. Could anyone show me how this is done? Thanks.[/QUOTE] What part do you now know? Custom 404 pages, or randomized images? Randomized images is the same as [URL="http://facepunch.com/showthread.php?t=1250244&p=40638175&viewfull=1#post40638175"][del]above[/del] previous page[/URL] but you should change the pre and pst to match an image (image tags and such). The array itself should have the file name of the image. Alternatively to pre-set images you could also get that array of filenames from a database if you have one.
I already had the 404 page, just not the image script thingy. And thanks for responding, but I already [url=http://www.marcofolio.net/webdesign/php_random_image_rotation.html]found something else[/url] which I found somewhat easy to understand. [url=http://kmlkmljkl.tk/404.html]Example[/url] (I don't have a lot of images yet, so don't expect to see a lot of variety yet)
That's easy, you can have a images folder with img1, img2, and img3 and use a simple for. If you want cool names on your images you can list all entries in a directory see if the last charaters are .jpg, .png or .gif and store them in a array with keys and randomize those keys... Maybe?
Anyone know how to do LiveReload to a different computer? Like I could sit in my living room (with laptop) and then it would refresh on my HTPC.
Ok, probably a really dumb question, but: How do you display an attribute value from an XML file using HTML/Javascript?
Anyone know what font this is? I remember it from somewhere but I can't put my finger on it. [img]http://i.imgur.com/odlrPIQ.png[/img]
[QUOTE=Cow Muffins;40666098]Ok, probably a really dumb question, but: How do you display an attribute value from an XML file using HTML/Javascript?[/QUOTE] [url=http://www.w3schools.com/dom/met_element_getattribute.asp]This?[/url] I know it's w3shools, don't hurt me.
[QUOTE=asantos3;40667147][url=http://www.w3schools.com/dom/met_element_getattribute.asp]This?[/url] I know it's w3shools, don't hurt me.[/QUOTE] That's exacty what I need. Thanks!
[QUOTE=The freeman;40667020]Anyone know what font this is? I remember it from somewhere but I can't put my finger on it. [img]http://i.imgur.com/odlrPIQ.png[/img][/QUOTE] Wouldn't this be better in the creationism corner? It's not exactly web-related. Anyway, you might want to try [url=http://www.myfonts.com/WhatTheFont/]WhatTheFont[/url]. [editline]16th May 2013[/editline] [QUOTE=asantos3;40667147][url=http://www.w3schools.com/dom/met_element_getattribute.asp]This?[/url] I know it's w3shools, don't hurt me.[/QUOTE] ... is there anything wrong with w3schools?
[QUOTE=kmlkmljkl;40667424]... is there anything wrong with w3schools?[/QUOTE] Outdated standards, generally bad examples, bad coding practice
Sorry, you need to Log In to post a reply to this thread.