• Web Development Questions That Don't Need Their Own Thread v2
    3,079 replies, posted
Why doesn't php.net tell you from which version a feature was available? Does anyone know when overloading (specifically method overloading) was made available? I need to support php 5.2.4 +.
Anyone know how to round down to the nearest hour in PHP? Like if I input 9:00:49 PM I get 9:00:00 PM. Keeping it in UNIX timestamp is fine too. nevermind, figured it out (time() - (time()%3600)) Does anyone know how I can do this for the nearest XX oclock of the day? For example always round down the input time to the closest 9:00 PM. July 13th, 2011 9:01:10 PM => July 13th, 2011 9:00:00 PM July 13th, 2011 11:41:10 PM=> July 13th, 2011 9:00:00 PM July 14th, 2011 5:41:10 AM=> July 13th, 2011 9:00:00 PM July 14th, 2011 10:57:10 PM=> July 14th, 2011 9:00:00 PM Hope ^ makes sense.
Anyone know how I'd go about creating a clock using HTML/javascript that will look roughly like this: [quote][img]http://i256.photobucket.com/albums/hh187/Hawkeye2008/Clock/Clock-Sketch.jpg[/img][/quote] Here's an example: [quote][img]http://i256.photobucket.com/albums/hh187/Hawkeye2008/Clock/Example2-51.jpg[/img][/quote] I think I'd need 29 images. Possibly 58 if I need another set of images for changing the colour, to specify what the time is. -- Sorry - I think I need to elaborate more. Instead of having numbers, I'd want it so that it shows each section (e.g. for the hours it'd be 1 section of the outer ring, for 10's it'd be the middle ring, and for minutes it'd be the inner most ring).. and they'd need to be sliced up into segments. So when it's a specific time only that segment changes colour/is highlighted... (Hope that helps)
[QUOTE=Streetser20;31097999]Anyone know how I'd go about creating a clock using HTML/javascript that will look roughly like this: Here's an example: I think I'd need 29 images. Possibly 58 if I need another set of images for changing the colour, to specify what the time is.[/QUOTE] uhh what I can only see the need to use one
[QUOTE=ken188;31097335]Anyone know how to round down to the nearest hour in PHP? Like if I input 9:00:49 PM I get 9:00:00 PM. Keeping it in UNIX timestamp is fine too. nevermind, figured it out (time() - (time()600)) Does anyone know how I can do this for the nearest XX oclock of the day? For example always round down the input time to the closest 9:00 PM. July 13th, 2011 9:01:10 PM => July 13th, 2011 9:00:00 PM July 13th, 2011 11:41:10 PM=> July 13th, 2011 9:00:00 PM July 14th, 2011 5:41:10 AM=> July 13th, 2011 9:00:00 PM July 14th, 2011 10:57:10 PM=> July 14th, 2011 9:00:00 PM Hope ^ makes sense.[/QUOTE] date('h:i a'); [url]http://php.net/manual/en/function.date.php[/url]
[QUOTE=ken188;31097335]Anyone know how to round down to the nearest hour in PHP? Like if I input 9:00:49 PM I get 9:00:00 PM. Keeping it in UNIX timestamp is fine too. nevermind, figured it out (time() - (time()600)) Does anyone know how I can do this for the nearest XX oclock of the day? For example always round down the input time to the closest 9:00 PM. July 13th, 2011 9:01:10 PM => July 13th, 2011 9:00:00 PM July 13th, 2011 11:41:10 PM=> July 13th, 2011 9:00:00 PM July 14th, 2011 5:41:10 AM=> July 13th, 2011 9:00:00 PM July 14th, 2011 10:57:10 PM=> July 14th, 2011 9:00:00 PM Hope ^ makes sense.[/QUOTE] [QUOTE=php.net][B]send at mail dot 2aj dot net[/B] [URL="http://www.php.net/manual/en/function.time.php#67546"]08-Jun-2006 06:58[/URL] If you want to create a "rounded" time stamp, for example, to the nearest 15 minutes use this as a reference: [PHP]<?php $round_numerator = 60 * 15 // 60 seconds per minute * 15 minutes equals 900 seconds //$round_numerator = 60 * 60 or to the nearest hour //$round_numerator = 60 * 60 * 24 or to the nearest day // Calculate time to nearest 15 minutes! $rounded_time = ( round ( time() / $round_numerator ) * $round_numerator ); //If it was 12:40 this would return the timestamp for 12:45; //3:04, 3:00; etc. ?>[/PHP][/QUOTE] Found this on [URL="http://www.php.net/manual/en/function.time.php#67546"]php.net[/URL][URL="http://php.net"][/URL], you should be able to figure out what to change to make this work.
[QUOTE=KmartSqrl;31090756]Why are you floating divs inside a table? Wat?[/QUOTE] I'm not sure of what you mean. I feel stupid now. :smith:
Wait you're not floating them I wasn't paying attention. In that case. Why you usin' tables boy?!
[QUOTE=KmartSqrl;31104714]Wait you're not floating them I wasn't paying attention. In that case. Why you usin' tables boy?![/QUOTE] Because I wanted two columns and viewed it as the easiest way. Unless I'm being silly and theres a way to make a two column div, is there?
[QUOTE=RELAXiN;31104815]Because I wanted two columns and viewed it as the easiest way. Unless I'm being silly and theres a way to make a two column div, is there?[/QUOTE] You use divs for logical divisions on a page; so for instance, if this is a layout, and you wanted two columns for the main content and sidebar, you'd use two divs to create two columns; tables for layout is totally depreciated now; only use tables for storing tabular data. Copy this into a new document and save it as an html file: [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <style type="text/css"> /* Don't define styles inline, this is just a quick example; move declarations to an external css file and invoke them with: <link rel="stylesheet" type="text/css" href="path/to/stylesheet.css"/> */ * { margin: 0; padding: 0; } body { color: #444; font-size: 13px; font-family: Verdana; background: #aaa; } #page { background: #fff; width: 960px; margin: 0 auto; overflow: auto; /* Overflow: auto; is a simple clearfix */} #main { float: left; width: 600px; height: 420px; /* Just a temporary declaration so you can see the columns - don't specify a height unless necessary */ padding: 20px; margin-right: 20px; } #side { background: #222; color: #aaa; float: left; width: 260px; padding: 20px; height: 420px; /* Just a temporary declaration so you can see the columns - don't specify a height unless necessary */ } </style> </head> <body> <div id="page"> <!-- Containing div (Holds both the main and side content) --> <div id="main"> <!-- The Main Section --> Main Content </div> <div id="side"> <!-- The Sidebar --> Sidebar Content </div> </body> </html>[/code]
Would diving into the world of web development with a start in forum styling be a bad idea?
[QUOTE=BrettJay;31105506]You use divs for logical divisions on a page; so for instance, if this is a layout, and you wanted two columns for the main content and sidebar, you'd use two divs to create two columns; tables for layout is totally depreciated now; only use tables for storing tabular data. Copy this into a new document and save it as an html file: [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <style type="text/css"> /* Don't define styles inline, this is just a quick example; move declarations to an external css file and invoke them with: <link rel="stylesheet" type="text/css" href="path/to/stylesheet.css"/> */ * { margin: 0; padding: 0; } body { color: #444; font-size: 13px; font-family: Verdana; background: #aaa; } #page { background: #fff; width: 960px; margin: 0 auto; overflow: auto; /* Overflow: auto; is a simple clearfix */} #main { float: left; width: 600px; height: 420px; /* Just a temporary declaration so you can see the columns - don't specify a height unless necessary */ padding: 20px; margin-right: 20px; } #side { background: #222; color: #aaa; float: left; width: 260px; padding: 20px; height: 420px; /* Just a temporary declaration so you can see the columns - don't specify a height unless necessary */ } </style> </head> <body> <div id="page"> <!-- Containing div (Holds both the main and side content) --> <div id="main"> <!-- The Main Section --> Main Content </div> <div id="side"> <!-- The Sidebar --> Sidebar Content </div> </body> </html>[/code][/QUOTE] Thanks for that, you learn something new every day eh.
[QUOTE=plazzydan;31105769]Would diving into the world of web development with a start in forum styling be a bad idea?[/QUOTE]That would be designing
[QUOTE=TehWhale;31110159]That would be designing[/QUOTE] Not only that, but the process of designing a layout and then coding a theme for a forum package is rather ambitious. Not to say it's impossible, but there's probably a better place to start.
Anyone who has had experience with large object orientated php projects may be able to point me in the right direction. I am writing a WordPress plugin framework (tired of having to repeat loads of code for my plugins). The project is too large to be one file so I have split it into sub sections (each there own class). I'm facing some problems. Basically this is the spec: - The framework may be included in multiple plugins running on the same blog and as a result each plugin has an instance of the framework class - Different versions of the framework may co-exist so the framework classes must be explicitly versioned You can see what I have currently on GitHub [url]https://github.com/SpidersDesign/SD-Wordpress-Plugin-Framework[/url] It's basically a main plugin class (spidersDesign_pluginFramework_1) which defines properties as the subclasses like $this->settings = new spidersDesign_pluginFramework_settings_1( $this ); The reason $this is passed as an argument is because the new instance needs to know within the context of which plugin it is running (as several plugin instances could exist). This has ended up in loads of spaghetti code with things like: [php] $this->context->settings->setting(); [/php] Which is precisely what I want to avoid. Before anyone suggests namespacing - I can't use namespacing because php 5.3 isn't widespread enough. I need a way of the sub classes having access to a particular instance of the parent class but don't know how to approach this. If I can't think of a great way of doing it i'll stick with what I've got.
[QUOTE=Ac!dL3ak;31081510]Has this happened to anybody else: I sent (proper) JSON data to a PHP file on my server, and PHP automatically escapes the quotes (both " and ' ), which fucks up json_decode. It took me a few minutes to figure out what exactly the fuck was going on, because wampserver has PHP 5.3.0 and my webserver has 5.2.something, so they both did different things. [editline]12th July 2011[/editline] sounds like the ZIP file is corrupt, I'd redownload it[/QUOTE] Tried that twice. Did'nt work
What would be the best language to start with in web development? I've tried my neck at games(2d and 3d) and just random applications but it didn't really fullfill what I was looking to do, So I've turned to web development, and I think there is alot of more money in web development and I want to get started early if I hope to succeed(being 15 leaves me with alot of options). So I ask you facepunch, what would be the best starting point in web development? php? java? perl? which? Also, with Ireland's economy crashing and burning, I need a life buoy to escape this titanic.
[QUOTE=geoface;31118316]What would be the best language to start with in web development? I've tried my neck at games(2d and 3d) and just random applications but it didn't really fullfill what I was looking to do, So I've turned to web development, and I think there is alot of more money in web development and I want to get started early if I hope to succeed(being 15 leaves me with alot of options). So I ask you facepunch, what would be the best starting point in web development? php? java? perl? which? Also, with Ireland's economy crashing and burning, I need a life buoy to escape this titanic.[/QUOTE] I'm not sure how it is there, but in the country in which I reside, all major companies care about how amazing and wonderful their websites look and not how efficiently it works, and thus they opt for Flash websites instead of dynamic ones. It usually has a lot of cash in it if you learn Flash. However, I usually work with things that I'm comfortable with and that's why I make dynamic websites, meaning PHP/MySQL and a bit of jQuery to tie things up.
[QUOTE=geoface;31118316]What would be the best language to start with in web development?[/QUOTE] Definitely learn PHP and Java. All of the most popular sites/ tools are based on these types of code, or some variation of them. Of course you should know CSS/HTML, but those are easy in comparison. You're at a good place to start, I kick myself all the time for not learning more PHP and Java when I had a ton of free time (when I was younger). But I've always been a more graphics person, so that was my main focus. I honestly wouldn't advise stressing on Flash. IMO it doesn't have enough longterm support. It is quickly becoming obsolete with the new code forms that can easily be learned/ integrated into a base knowledge of PHP, HTML, Java, and CSS.
[QUOTE=BrettJay;31110592]Not only that, but the process of designing a layout and then coding a theme for a forum package is rather ambitious. Not to say it's impossible, but there's probably a better place to start.[/QUOTE] Forums just seem to be what I naturally gravitate to when I want to make something. I don't know why.
Okay. New problem, I decided against wordpress and decided on mybb since I wanted to make a forum anyway. I followed the guide with filezilla but when I type in myurl.x10.mx/forum/install I dont get a prompt to download the installer or anything. Just the index. Help?
[QUOTE=tinos;31118996]Definitely learn PHP and Java. All of the most popular sites/ tools are based on these types of code, or some variation of them. Of course you should know CSS/HTML, but those are easy in comparison. You're at a good place to start, I kick myself all the time for not learning more PHP and Java when I had a ton of free time (when I was younger). But I've always been a more graphics person, so that was my main focus. I honestly wouldn't advise stressing on Flash. IMO it doesn't have enough longterm support. It is quickly becoming obsolete with the new code forms that can easily be learned/ integrated into a base knowledge of PHP, HTML, Java, and CSS.[/QUOTE] Thanks for the advice, I might look into Java first and see how I go from there.
[QUOTE=Dogass;31123075]Okay. New problem, I decided against wordpress and decided on mybb since I wanted to make a forum anyway. I followed the guide with filezilla but when I type in myurl.x10.mx/forum/install I dont get a prompt to download the installer or anything. Just the index. Help?[/QUOTE] Need help quick
[QUOTE=tinos;31118996]Definitely learn PHP and Java. All of the most popular sites/ tools are based on these types of code, or some variation of them. Of course you should know CSS/HTML, but those are easy in comparison. You're at a good place to start, I kick myself all the time for not learning more PHP and Java when I had a ton of free time (when I was younger). But I've always been a more graphics person, so that was my main focus. I honestly wouldn't advise stressing on Flash. IMO it doesn't have enough longterm support. It is quickly becoming obsolete with the new code forms that can easily be learned/ integrated into a base knowledge of PHP, HTML, Java, and CSS.[/QUOTE] do you mean java or javascript?
[QUOTE=Ac!dL3ak;31125313]do you mean java or javascript?[/QUOTE] most likley javascript
Java is to Javascript is about the same as fun is to funeral.
[QUOTE=tinos;31118996]Definitely learn PHP and Java.[/QUOTE] I'm sorry but if you don't know the difference between Java and JavaScript I'm not sure you can recommend languages or anything.
Just wanna check if this is viable: for my site, could I have a div which is, say, 400% wide, which is divided into 4 x 100% pieces which are essentially the site pages, and when links to pages are clicked, the div is scrolled to the 100% position of the appropriate page, if you know what I mean?
[QUOTE=Alcapwne;31129018]Just wanna check if this is viable: for my site, could I have a div which is, say, 400% wide, which is divided into 4 x 100% pieces which are essentially the site pages, and when links to pages are clicked, the div is scrolled to the 100% position of the appropriate page, if you know what I mean?[/QUOTE] Something like this? [url]http://melissahie.com/[/url]
[QUOTE=Alcapwne;31129018]Just wanna check if this is viable: for my site, could I have a div which is, say, 400% wide, which is divided into 4 x 100% pieces which are essentially the site pages, and when links to pages are clicked, the div is scrolled to the 100% position of the appropriate page, if you know what I mean?[/QUOTE] Possible, or just set to pages with 100% width and then whenever someone clicks on an arrow or whatever, you set display:hidden; for that specific div (which is really a page), and then show the page after it. This can be easily done using jQuery.
Sorry, you need to Log In to post a reply to this thread.