Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
Try
[CODE]app.render("applications", { applications: applications });[/CODE]
instead of
[CODE]app.render("applications", applications, function(err, html){});[/CODE]
The third callback argument is optional.
[editline]25th April 2013[/editline]
[CODE]
- if (typeof(applications) !== 'undefined')
ul
- each app in applications
li= app.status
- else
p Blank slate mate...
[/CODE]
As long as you're passing the template the results of the query you'll always get an array back so you'll need to check the length:
[CODE]
- if (applications.length)
ul
- each app in applications
li= app.status
- else
p Blank slate mate...
[/CODE]
Has anyone documented an API before (in php) and got any pre-made templates that they know of online, as my current documentation is terrible.
[QUOTE=Snakess;40417471]Has anyone documented an API before (in php) and got any pre-made templates that they know of online, as my current documentation is terrible.[/QUOTE]
Have a look at the PHPDoc standard and phpDocumentor.
I want to make a replacement skin for facepunch, is there currently a premade theme + script that I can take apart and modify to make one?
[QUOTE=01271;40445836]I want to make a replacement skin for facepunch, is there currently a premade theme + script that I can take apart and modify to make one?[/QUOTE]
The whole web dev section was actually doing a re-design a while back. But apparently, nothing happened.
xPaw did an improvement to the CSS, but other than that there isn't anything that I know of.
I am trying to make a loading screen for my TTT server and I am playing around with PHP to try and get a randomized YouTube video playing in the background.
The thing is is that I don't know much of PHP.
What I have read on Google has lead me to this:
[HTML]<?php
$youvids = array('http://www.youtube.com/v/nJgKy_0VDb4?version=3&autoplay=1', 'http://www.youtube.com/v/MK5aWrtFAhM?version=3&autoplay=1');
$randomize = $youvids[mt_rand(0,1)];
?>
<html>
<head>
<style type="text/css"></style>
</head>
<body>
<center><img src="pic1.jpg"/></center>
<br>
<object width="640" height="390">
<param name="movie"
value="<?php echo $randomize; ?>"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="<?php echo $randomize; ?>"
type="application/x-shockwave-flash"
allowscriptaccess="always"
width="640" height="390"></embed>
</object>
</body>
</html>[/HTML]
1. Is the php set out correctly?
2. Will this even work?
3. What file do I save it as? (.html or .php etc.)
4. How do I get the video to be hidden? (reducing the pixels to <200 doesn't work)
Help is appreciated ^_^
[QUOTE=EmeraldStar82;40451089]I am trying to make a loading screen for my TTT server and I am playing around with PHP to try and get a randomized YouTube video playing in the background.
The thing is is that I don't know much of PHP.
What I have read on Google has lead me to this:
1. Is the php set out correctly?
2. Will this even work?
3. What file do I save it as? (.html or .php etc.)
4. How do I get the video to be hidden? (reducing the pixels to <200 doesn't work)
Help is appreciated ^_^[/QUOTE]
1.It is, although with only two songs it may be a bit repetitive.
2.Yeah.
3.As it has a bit of PHP, you need to save it as .php
4.Hide it with CSS. object{opacity:0;}
[QUOTE=Coment;40452505]1.It is, although with only two songs it may be a bit repetitive.
[/QUOTE]
There is room to add more URL's though isn't there?
[CODE]$randomize = $youvids[mt_rand(0,1)];[/CODE]
Don't I just also need to change the 1 to however many there are -1?
[QUOTE=EmeraldStar82;40452583]There is room to add more URL's though isn't there?
[CODE]$randomize = $youvids[mt_rand(0,1)];[/CODE]
Don't I just also need to change the 1 to however many there are -1?[/QUOTE]
Yeah, it is.
If you're going to be adding/removing them frequently, though, you might want to just
[code]
$randomize = $youvids[mt_rand(0,count($youvids)-1)];
[/code]
[QUOTE=Coment;40452505]
4.Hide it with CSS. object{opacity:0;}[/QUOTE]
[code]div {
display:none;
}[/code]
where do you learn css? Because this is the 2nd time i've seen someone do it on fp webdev.
@EmeraldStar82
Use the newer iframe embedding method, it will fall back to HTML5 video if they don't have flash.
[PHP]
<?php
$videos = array('nJgKy_0VDb4', 'MK5aWrtFAhM');
shuffle($videos);
?>
<iframe width="0" height="0" src="http://www.youtube.com/embed/<?php echo $videos[0]; ?>?rel=0" frameborder="0" ></iframe>
[/PHP]
[QUOTE=gokiyono;40386796]I am a little confused. (A theoretical question.)
In school I have gotten told to not use tables for styling purposes.
Like [URL="http://i.imgur.com/JEBC5Qo.png"]this[/URL].
It just seems more fitting (to me) to use a table here.
[editline]23rd April 2013[/editline]
I have bad experience with accidentally closing chats and tabs I need down by accident.
Annoying gets useful in certain accidents.[/QUOTE]
They are right, tables should only be used for storing tabular data, in that case just style up a form.
[QUOTE=Sharpshooter;40457716]They are right, tables should only be used for storing tabular data, in that case just style up a form.[/QUOTE]
Why is that?
Does anyone know of any Stripe alternatives for Europe/Scandinavia? Norway to be more specific!
hmm, getting some weird issues with my site, specifically with margins on my bottom bit.
for example, the [URL="http://soleedus.me"]main page[/URL], which looks fine
however, on my [URL="http://soleedus.me/404.htm"]404 page[/URL], the bottom bit completely breaks with the addition of another tile, as seen here:
[t]http://puu.sh/2JR21.png[/t]
I've tried changing the margins in my [URL="http://pastebin.com/mCPfz0tj"]CSS[/URL] to no avail. probably a dumb little mistake I'm making, but i'm not entirely sure. anyone know what's fucked?
Why do you have separate style-sheets for the 404 page and the rest of the site? It's CSS, let it cascade.
Not entirely sure what you want it to do when you have more than 5, could you post a mock-up?
[QUOTE=Soleeedus;40473289]hmm, getting some weird issues with my site, specifically with margins on my bottom bit.
for example, the [URL="http://soleedus.me"]main page[/URL], which looks fine
however, on my [URL="http://soleedus.me/404.htm"]404 page[/URL], the bottom bit completely breaks with the addition of another tile, as seen here:
[t]http://puu.sh/2JR21.png[/t]
I've tried changing the margins in my [URL="http://pastebin.com/mCPfz0tj"]CSS[/URL] to no avail. probably a dumb little mistake I'm making, but i'm not entirely sure. anyone know what's fucked?[/QUOTE]
Because the wrapper you have housed them in (if i'm not being completely stupid here), is only 800px wide, which can only house 5 150x150 tiles, increasing the size to 900px should fix it.
Nice site btw.
[QUOTE=Soleeedus;40473289]hmm, getting some weird issues with my site, specifically with margins on my bottom bit.
for example, the [URL="http://soleedus.me"]main page[/URL], which looks fine
however, on my [URL="http://soleedus.me/404.htm"]404 page[/URL], the bottom bit completely breaks with the addition of another tile, as seen here:
[t]http://puu.sh/2JR21.png[/t]
I've tried changing the margins in my [URL="http://pastebin.com/mCPfz0tj"]CSS[/URL] to no avail. probably a dumb little mistake I'm making, but i'm not entirely sure. anyone know what's fucked?[/QUOTE]
[code].wrapper
{
width: 960px;
}[/code]
[QUOTE=Knallex;40467910]Does anyone know of any Stripe alternatives for Europe/Scandinavia? Norway to be more specific![/QUOTE]
Can't you do the same thing with PayPal?
Why am I getting this 1px line at the top;
[img]http://puu.sh/2Kcow/b89243be64.png[/img]
The margin and padding are 0px....
[QUOTE=jaooe;40479554]Why am I getting this 1px line at the top;
[img]http://puu.sh/2Kcow/b89243be64.png[/img]
The margin and padding are 0px....[/QUOTE]
do you have border? we can't some this without you giving us anything. please use [url]http://jsfiddle.net/[/url]
[QUOTE=xmariusx;40478746]Can't you do the same thing with PayPal?[/QUOTE]
PayPal isn't as good as a web developing solution imo. But I guess it's fine, you just have to do a bit of verification. (PayPal pay buttons are a vulnerability)
[QUOTE=P1raten;40476020][code].wrapper
{
width: 960px;
}[/code][/QUOTE]
god fuck, I was changing the wrapper width but that wasnt doing anything. it works now, thanks bro
[QUOTE=jung3o;40480373]do you have border? we can't some this without you giving us anything. please use [url]http://jsfiddle.net/[/url][/QUOTE]
There's no border no, It looks fine on jsfiddle, [url]http://jsfiddle.net/ruWAJ/[/url]
[QUOTE=xmariusx;40478746]Can't you do the same thing with PayPal?[/QUOTE]
I'd rather just have a solution where you pay with a credit card. Thinking of testing PayEx out.
[QUOTE=jaooe;40480598]There's no border no, It looks fine on jsfiddle, [url]http://jsfiddle.net/ruWAJ/[/url][/QUOTE]
then use normalize.css
[url]http://necolas.github.io/normalize.css/[/url]
[QUOTE=jung3o;40481538]then use normalize.css
[url]http://necolas.github.io/normalize.css/[/url][/QUOTE]
Still doesn't work :/
[QUOTE=jaooe;40486890]Still doesn't work :/[/QUOTE]
Don't know if I'll be able to help, but that white line is something that appeared on mine once. I just bumped the top margin to -1 and it went away.
How do I take the input from <input> and process it in my java function?
[QUOTE=gaige333;40487276]Don't know if I'll be able to help, but that white line is something that appeared on mine once. I just bumped the top margin to -1 and it went away.[/QUOTE]
Didn't think of that, D'oh. Cheers!
[QUOTE=cdot;40487864]How do I take the input from <input> and process it in my java function?[/QUOTE]
Google "forms javascript" and you'll find everything you need.
Sorry, you need to Log In to post a reply to this thread.