Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=Elecbullet;40956387]/html/
This is from [url]http://vi.avatar.wikia.com/wiki/Th%E1%BB%83_lo%E1%BA%A1i:B%C3%A0i_vi%E1%BA%BFt[/url] Due to some poor support for the Vietnamese alphabet, Đ comes at the end, rather than after D where it is supposed to be - this irritates my friend.
The structure of the code is represented above (note that many elements are left collapsed in my representation).
Any Javascript experts know how I would move the <h3>Đ</h3> behind the <h3>D</h3>, and also move the following UL? I am not able to manually edit the HTML.[/QUOTE]
Since this doesn't appear to be solved yet, try this:
[code]
$("h3:contains(D)").next().after($("h3:contains(Đ), h3:contains(Đ) + ul"));
[/code]
This selects '$("h3:contains(Đ), h3:contains(Đ) + ul")', which is the <h3> containing Đ and the <ul> right after, then moves it to after the <h3> that contains a regular D.
Result:
[t]http://puu.sh/3bHBL.jpg[/t]
What kind of asshole do you have to be to not make the loop variables scoped in PHP? I made a for loop which looped from $i = 1 to whatever number of files I want to include, and one of the included file had another for loop which used $i too, so it just made the first loop skip some included files, leaving me confused for a while. What kind of design decision is this? Why did the creator of PHP made it like that?
Other than that, I just started learning PHP [URL="http://www.php5-tutorial.com/"]with this site[/URL], and I want to ask if it is a good idea to learn it from there?
[QUOTE=ichiman94;40961627]What kind of asshole do you have to be to not make the loop variables scoped in PHP? I made a for loop which looped from $i = 1 to whatever number of files I want to include, and one of the included file had another for loop which used $i too, so it just made the first loop skip some included files, leaving me confused for a while. What kind of design decision is this? Why did the creator of PHP made it like that?
Other than that, I just started learning PHP [URL="http://www.php5-tutorial.com/"]with this site[/URL], and I want to ask if it is a good idea to learn it from there?[/QUOTE]
That's pretty standard if you have nested loops, there's no reason why the increment variable used in the outer loop wouldn't be available in the inner loop.
Well, If you have something like this:
[code]for ($i = 0; $i < 10; $i++)
{
include("include" . $i . ".php");
}[/code]
and include3.php:
[code]for ($i = 0; $i < 5; $i++)
{
//do something
}[/code]
the outer $i shouldn't be changed, or the interpreter should warn/error the user about that, like C#'s compiler does.
[B]Edit:[/B] Whatever, I didn't think about that much. I should not post about these things.
Well, including pages like that is pretty weird anyway. I thought including was the same as placing the code there directly? The way you do it would make some pretty messy code.
For multiple includes, it's cleaner to just create a global.php file which includes the needed files. And when you want to load the includes just include the global.php and it's all done. It's alot cleaner to use in case you want to release the project to the public.
Includeception!
No, I wouldn't release it to the public, it's just was me having fun with stuff. Other than that, I'm just learning PHP, nothing more... it might come handy later.
Why does this happen?
[img]http://i.imgur.com/MgGqOOl.jpg[/img]
The first 123 starts at about the top of the image, and the second 123 is much lower. Any way to fix this?
Code:
HTML
[code]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>dongs</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<img src="img/grid-2-us_11_pac_m_130402150751.jpg" width="200" height="200" class="game" />
<h1> 123</h1>
<h2>This Week: - </h2>
<h2>Last Week: - </h2>
<h2>Peak: -</h2>
<br/>
<img src="img/90a4165feb5a1845819c4fd8505fe4cc.jpeg" width="200" height="200" class="game" />
<h1> 123</h1>
<h2>This Week: -</h2>
<h2>Last Week: - </h2>
<h2>Peak: -</h2>
<br/>
</body>
[/code]
CSS
[code]
body {
font-family:Arial, Helvetica, sans-serif;
}
.game {
float:left;
padding-bottom:5px;
padding-right:5px;
}
[/code]
[QUOTE=The freeman;40967390]Why does this happen?
[img]http://i.imgur.com/MgGqOOl.jpg[/img]
The first 123 starts at about the top of the image, and the second 123 is much lower. Any way to fix this?
Code:
HTML
[code]<stuff></stuff>
[/code]
CSS
[code]
stuff{
more:stuff;
}
[/code][/QUOTE]
[URL="http://jsfiddle.net/gokiyono/ZqSBg/"]Fiddle me this[/URL]
All you needed to do was to close the elements in <div> tags.
[editline]10th June 2013[/editline]
Also, maybe you should use <li> tags instead of h2.
[QUOTE=eternalflamez;40958610]Since this doesn't appear to be solved yet, try this:
[code]
$("h3:contains(D)").next().after($("h3:contains(Đ), h3:contains(Đ) + ul"));
[/code]
This selects '$("h3:contains(Đ), h3:contains(Đ) + ul")', which is the <h3> containing Đ and the <ul> right after, then moves it to after the <h3> that contains a regular D.
Result:
[t]http://puu.sh/3bHBL.jpg[/t][/QUOTE]
[php]$("h3:contains(A)").next().after($("h3:contains(Ă), h3:contains(Ă) + ul"));
$("h3:contains(A)").next().after($("h3:contains(Â), h3:contains(Â) + ul"));
$("h3:contains(D)").next().after($("h3:contains(Đ), h3:contains(Đ) + ul"));
$("h3:contains(E)").next().after($("h3:contains(Ê), h3:contains(Ê) + ul"));
$("h3:contains(O)").next().after($("h3:contains(Ô), h3:contains(Ô) + ul"));
$("h3:contains(O)").next().after($("h3:contains(Ơ), h3:contains(Ơ) + ul"));
$("h3:contains(U)").next().after($("h3:contains(Ư), h3:contains(Ư) + ul"));[/php]
Hey, that works really well, thanks.
Yeah, use:
[code]$("div#mw-pages h3:contains(D)").next().after($("div#mw-pages h3:contains(Đ), div#mw-pages h3:contains(Đ) + ul"));[/code]
Basically by adding "div#mw-pages " at the start of each selector, it only affects <h3>'s that are inside a <div> with the id "mw-pages".
By the way, these things work with css selectors, if you want to learn a bit on how you could use these things later on, read this:
[url]http://www.w3.org/TR/CSS2/selector.html[/url]
Does anyone know if I load an HTML file formatted as JSON I can parse it using JS? Dealing with some shitty SaaS and want to get around it's restrictions by outputting the content into JSON or XML and outputting the data with that.
Usually I would scoff at the idea of using JS to do anything, but as the entire site will break without JavaScript anyway, I'm not that bothered.
[QUOTE=Shadow801;40971162]Does anyone know if I load an HTML file formatted as JSON I can parse it using JS? Dealing with some shitty SaaS and want to get around it's restrictions by outputting the content into JSON or XML and outputting the data with that.
Usually I would scoff at the idea of using JS to do anything, but as the entire site will break without JavaScript anyway, I'm not that bothered.[/QUOTE]
So if I understand your question properly... the answer is yes. JSON is a broad spec, you can transfer pretty much any kind of data with it. Also Javascript is pretty badass, you can do a lot with it - not sure why you're scoffing at the idea of using it.
Can you give more details please?
- Are you controlling the encoding of the HTML data into JSON?
- Do you have control over how the HTML is encoded into JSON? Or does the SAAS do the encoding?
- What SAAS is it?
- Where's the endpoint where the JS will parse the JSON... is it a server or is it a page on the SAAS?
Thanks!
Managed to get the JSON to read from an HTML file.
Just wondering, what do people think about headers in Navigation?
Say I have a list for a navigation:
[code]
<ul>
<li><h3>Streaming</h3></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
[/code]
Would that be incorrect? In terms of the document outline, semantics and SEO?
[QUOTE=Shadow801;40990484]Managed to get the JSON to read from an HTML file.
Just wondering, what do people think about headers in Navigation?
Say I have a list for a navigation:
[code]
<ul>
<li><h3>Streaming</h3></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
[/code]
Would that be incorrect? In terms of the document outline, semantics and SEO?[/QUOTE]
[del]List for navigation?
That seems ok to me.[/del]
I think he means the fact that he has a header in it.
I don't think that will affect your website in any bad way.
[QUOTE=eternalflamez;40990609]I think he means the fact that he has a header in it.
I don't think that will affect your website in any bad way.[/QUOTE]
Damn.
Nothing bad would be able to happen by doing it.
Im making a site for the web development class Im taking and Im such a fucking newbie.
I need a javascript in my code and I dont even know how javascripts work, is it possible to find a easy and good javascript thats placable inside the .css?
Why would you want to place javascript inside the css?
[QUOTE=eternalflamez;40991830]Why would you want to place javascript inside the css?[/QUOTE]
Because of newb, I just need to have a javascript in my code due to it being a must for getting a grade.
Well, what kind of website is it? Maybe we can figure out something simple to do with javascript on your website?
Oh, and as clarification, script (probably) doesn't work if you put it in a css file. You would have to place it within <script> tags or in a seperate file.
Prepare for horror, its supposed to be bad but not this bad:
[html]<!DOCTYPE html>
<html>
<head>
<link href="borders.css" rel="stylesheet">
<title>Frallmer- för oss som gillar att vara dominerade</title>
</head>
<body>
<div class="background">
<div class="bild1"></div>
<div class="top"><h1>Frallmer.se!
Kattägare? Vila i frid.</h1>
</div>
<!-- Här sköts navigeringen mellan sidor -->
<div class="sidebar">
<ul class="navigering">
<li><a href="sida2.html">Fakta</a>
<li><a href="sida3.html">Konkelbärskastningen 2011</a>
<li><a href="grejer.html">Anledningen till varför vi finns</a>
</ul>
</div>
<div class="main">
<img place border="0" class="bild1" src="http://gif-favicon.com/images/animals/cat-domestic-house-transparent-background-0150-10014.gif" alt="tissekissebajs">
<br>brum brum burum</br>
</div>
</div>
<!--Här sköts andra sidebar:en-->
<div class="sidebar2">
<center><h3>Få nyhetsblad här!</h3></center>
<form action="mailto:snopp_jocke420@hotmail.com" method="post">
<br> Namn: <input type="tex" name="namn" size="20"/></br/>
E-post: <br> <input type="text" name="epost" size="20"/> </br>
<br>Fyll i detta för nyhetsblad och dem senaste videoklippen och annat härj!</br>
Jag har läst och förstår <a href="http://cdn.memegenerator.net/instances/400x/29067689.jpg">reglerna</a> <br/>
--><em><input type="checkbox" name="EULA" value="JA"/><--
</form></em>
<center><form name="input" action="http://sphotos-g.ak.fbcdn.net/hphotos-ak-ash3/555209_515216438509185_520716992_n.jpg" method="get">
<br><input type="submit" value="Skicka"></br>
</form></center>
<br></br>
</div>
</div>
</body>
</html>[/html]
And the css:
[html]
.background {
width:1200px;
height:600px;
margin-left:auto;
margin-right: auto;
margin-bottom: auto;
margin-top:40px;
border-radius:25px;
background-color:#c8b560;
border:groove;
border-color:#ecd872;
padding:4px;
}
.top {
width: 800px;
position:relative;top:5px;
height: 90px;
margin-left: auto;
margin-right:auto;
padding:10px;
background-color: #ffe87c;
border: ridge;
text-align: center;
border-color: #ecd872;
border-witdh:10px;
border-radius:20px;
}
.sidebar{
width:185px;
height: 200px;
margin-left:center;
margin-right:auto;
background-color:#ffe87c;
border: ridge;
border-color: #ecd872;
border-witdh:10px;
border-radius:20px;
}
.main {
width:800px;
position:relative;top:-185px;
height:450px;
margin-top:auto;
margin-left: auto;
margin-right: auto;
background-color: white;
border:double;
border-color: #ecd872;
font-family: sans-serif;
text-align-last: auto;
padding: 1.5px;
}
.sidebar2 {
width:185px;
height:auto;
text-align: center;
position:relative;top:-490px; left:-29px !important;
margin-left:auto;
margin-right:true;
background-color:#ffe87c;
border: ridge;
border-color: #ecd872;
border-witdh:10px;
border-radius:20px;
}
.bild1 {
position:relative;
left:325px;
}
[/html]
[editline]11th June 2013[/editline]
and yes, first site ever.
[QUOTE=Rankzerox;40992872]Because of newb, I just need to have a javascript in my code due to it being a must for getting a grade.[/QUOTE]
Jquery.
It cannot be said enough times.
[quote='his css']
="entity label">height: 90px;
[/quote]
What's that supposed to do? I've never seen that first part before.
[QUOTE=eternalflamez;40994736]What's that supposed to do? I've never seen that first part before.[/QUOTE]
I think the picture inside was made into a class
Also, your textbox for Namn has type="tex", should be text ofcourse.
And the first form has no submit button. Other than the layout, it could be worse.
[QUOTE=Rankzerox;40994044]Prepare for horror, its supposed to be bad but not this bad:
[html]<!DOCTYPE html>
<html>
<head>
<link href="borders.css" rel="stylesheet">
<title>Frallmer- för oss som gillar att vara dominerade</title>
</head>
<body>
<div class="background">
<div class="bild1"></div>
<div class="top"><h1>Frallmer.se!
Kattägare? Vila i frid.</h1>
</div>
<!-- Här sköts navigeringen mellan sidor -->
<div class="sidebar">
<ul class="navigering">
<li><a href="sida2.html">Fakta</a>
<li><a href="sida3.html">Konkelbärskastningen 2011</a>
<li><a href="grejer.html">Anledningen till varför vi finns</a>
</ul>
</div>
<div class="main">
<img place border="0" class="bild1" src="http://gif-favicon.com/images/animals/cat-domestic-house-transparent-background-0150-10014.gif" alt="tissekissebajs">
<br>brum brum burum</br>
</div>
</div>
<!--Här sköts andra sidebar:en-->
<div class="sidebar2">
<center><h3>Få nyhetsblad här!</h3></center>
<form action="mailto:snopp_jocke420@hotmail.com" method="post">
<br>*Namn: <input type="tex" name="namn" size="20"/></br/>
*-- snip --
position:relative;
left:325px;
}
[/html]
[editline]11th June 2013[/editline]
and yes, first site ever.[/QUOTE]
Eh, I've seen people get paid good money for worse.
[QUOTE=Rankzerox;40994044]Prepare for horror, its supposed to be bad but not this bad:
and yes, first site ever.[/QUOTE]
I find it strangely adorable that you have stuff in <br></br> tags.
Hmm
Why are there a div for the background?
And what does "It is supposed to be bad, but not this bad" mean if I may ask?
[QUOTE=Rankzerox;40994779]I think the picture inside was made into a class[/QUOTE]
Yes but the part that says [quote]="entity label"[/quote] is something I'm unfamiliar with. What does it do?
Also, about the javascript. I suppose it would be relatively easy to just have the browser send an alert when the name and/or email fields are empty.
Edit: -For more info on this, look here: [url]http://www.w3schools.com/js/js_form_validation.asp[/url].
Here's an example: [URL="http://www.w3schools.com/js/tryit.asp?filename=tryjs_form_validation"]Example[/URL]
Yes, I know, w3schools, whatever, I don't think this js is bad-
[editline]11th June 2013[/editline]
Howcome you know no Javascript but your teacher makes you use it anyway?
[QUOTE=gokiyono;40994835]I find it strangely adorable that you have stuff in <br></br> tags.
Hmm
Why are there a div for the background?
And what does "It is supposed to be bad, but not this bad" mean if I may ask?[/QUOTE]
I kinda wanted to look like it was really shitty, so it was funny, but its not fun when its beyond not-fun-shit
[editline]11th June 2013[/editline]
[QUOTE=eternalflamez;40994847]Yes but the part that says is something I'm unfamiliar with. What does it do?
[/QUOTE]
Im using Komodo so it changes the names of my things when I ctrl-c them for some odd reason, its supposed to make the image be in the center of the .main
[editline]11th June 2013[/editline]
[QUOTE=gokiyono;40994835]I find it strangely adorable that you have stuff in <br></br> tags.
[/QUOTE]
I would love to remove them somehow but Im just so bad at this
[editline]11th June 2013[/editline]
Arrrgh I dont even know what type of JQuery Im supposed to download :(
Sorry, you need to Log In to post a reply to this thread.