Jump to content

Amplivyn

Members
  • Posts

    26
  • Joined

  • Last visited

About Amplivyn

  • Birthday 03/02/1993

Profile Information

  • Gender
    Male
  • Interests
    Programming with Python, PHP, JavaScript
    Swimming
    Guitar
    Reading

Amplivyn's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Surely most people here use a header php file that they include in the top of most pages in a website. I was wondering, does anyone else split them into two header files to leave editable space between the <head> tag so you can include CSS/JS scripts for some pages that most of the others don't require? For example, I might have a single page that requires jQuery or a special CSS file for the home page, etc. If this is a bad idea, is there a better practice out there? I'd rather not include some files in all the pages.
  2. Alright, I might need some help with the last step, I am at the stage where I want to output the booked slots. I currently have some code to output the required table and fill it with free slots. I need to alter it to output booked slots if the current row (date) is inside a booked date. The dates in the MySQL database are stored as starting dates and ending dates in "YYYY-MM-DD" format. Using a query, I am able to get these starting/ending dates in pairs, still in MySQL format. While outputting the table, I am using the DateTime object to keep track of days. This makes it easy to check if a date is before or after (or between) other DateTime objects (using < and >). My problem is, is there an easy way that I am unaware of to convert MySQL dates to DateTime objects? Also, the algorithm I have in mind is something like this, just before outputting the row and check if that date is in any of the starting/ending periods (linear search), if yes, output the appropriate booked slots. This is done for each row, it's all I have, but it seems really inefficient.
  3. Alright here's what I have so far. I have 3 tables on the server, a customer table (name, contact details, etc.), a transactions table (user id, amount paid, date, etc.) and a bookings table (user id, date, slot). Since there are only 8 fixed slots per day (every 3 hours), instead of a starting time and ending time, I will only have a slot number (1-8 for instance). On the actual page, there will be some code to get today's date (DateTime object) and output a row of "FREE" slots, add a day and output more slots until the desired number of rows is reached. However, it will also get the bookings table (sorted in ascending order by date) and while outputting those rows, it will check to see if there are any bookings on that day and if so, output the appropriate "BOOKED" slots. For the actual booking, it may be tedious to check boxes, especially if some are ahead of time and not displaying on the table. Instead, I will have a form requesting a starting date and either an ending date or a number of days. That way if it starts on 1st March, the admin could choose the last day as 3rd March or 3 days of bookings. Of course, I will also have check boxes to choose the slots on those days. I'm also thinking of adding an "Except" selection list, for example, except weekends, Mondays, etc. For anyone interested about the 3 tables above, the admin will choose an existing customer or make a new one (enter details and so on). The admin will then proceed to record a transaction (if any) and in the case of renting stuff, he will then choose the required bookings and store them. As PFMaBiSmAd mentioned, these records are unlikely to be deleted and will be kept for future purposes. Finally, I wanted to see what you guys think is better, the website will have 3 of these rental tables for 3 different products. Would it be better to have 3 different booking tables on the server or just one with a "product type" field to filter out results? I'm leaning more towards the latter but I would like to hear your opinions, thanks!
  4. This sounds great, one thing that could be done is set up the page, make it look nice and so on. An optimized PHP Freaks logo would be suitable for the profile picture. Just wondering though, is the PHP Freaks forum community separate from the actual website? It seems that www.phpfreaks.com and the forums feel distinctly different, for one, the forums seem like the main focus and a lot cleaner than the main site. It would be a good idea to know which sort of theme to present on that page, from the current background, I would say the forums. The speech bubble with the "<?php" isn't such a bad idea for a profile picture and maybe the circular logo somewhere in the header space.
  5. That sounds like a good idea, I'm going to try to implement it now. I'm still stuck on how to let the admin store those booked values, I was thinking perhaps have them enter some sort of coordinates to determine the size of the booked block, for example, 1-8 width and 4-7 height for instance to cover the first block in the picture above (all hours from the 26th to the 29th of Jan). Of course I would have to link dates so that I don't get a fixed block but I'll figure it out when I get to it, thanks!
  6. Beautiful. But seriously, is anyone other than me at all interested in reviving @thephpfreaks? For a start, the display name could be changed to PHP Freaks to make it easier to find. It could be converted into a semi-blog page where interesting topics from PHP Freaks and others (about php, web development and more) are posted. To aid with resources, a forum post could be started here where individual PHP Freaks can post what they think is interesting and have their stuff promoted to the twitter page.
  7. I mean, why not? It's probably much easier to get the word out there than with Facebook plus it's an easy way to post small updates or link to articles here. It would definitely be a good addition for all PHP Freaks on twitter.
  8. I have a few questions regarding a table which displays rent slots. It will basically have the dates on the leftmost column (Jan 1,2,3,...) and the possible renting hours on the header (12:00-15:00, 15:00-18:00, 18:00-21:00 and so on). On the website, it will display 30 days from today, i.e 30 rows (Jan 29 to Feb 27 for instance). A picture of what I mean may help (not 30 days but never mind). Is it possible to automatically add rows to the MySQL table including free slots or would it be better to already have slots planned and ready in the existing table (say, an entire year of dates for example)? And just wondering what you guys think, would it be a good idea to have "free" and "booked" stored as Boolean values (0s and 1s) and print what they mean as the page processes? Also, to display today's date as the first row, would it be better to delete days that have already ended and fetch the first row OR search for today's date in the table and then display it? Finally, the users/customers will be able to choose slots only by contacting the website admin who then changes free slots to booked slots. Is there an easy way to modify these slots from the browser? Ideally, the admin would highlight the slots to be booked and the code will handle the rest, but I'm not really sure how to do this. The admin may be changing many slots at a time (often consecutive but not always). Does anyone have any ideas on how to traverse through a table?
  9. As far as I know (I may be wrong), but I don't think you can edit your .js file using php. You may, however, wish to output some .js script/code onto your page, using php, which may include a variable such as var showMenu = true or false. Using this, you can write code in your .js file to show your menu or not. Just be careful of declaring this variable before you run the menu code. This is also one way of doing things but may not be the best, in any case, good luck!
  10. Do you have your project stored in the web server root directory?
  11. I am guessing you need to have proper HTML table structure, essentially, add <table> and </table> around "<tr><td class="myValue">25</td></tr>" <body> <table> <tr> <td class='myValue'>25</td> </tr> </table> </body> Doing this made the code work and changed the color of 25 to red, good luck!
  12. I am checking this from my phone using the safari web browser, unless it is supposed to be like that, it seems things are out of place and cluttered in places. I can somewhat imagine what it might look like on a computer, I'll check that tomorrow and give you feedback then, but it seems you have the colors fitting well together. In the meantime, here's a screenshot. http://img37.imageshack.us/i/imagejna.jpg/
  13. Post the script under the input text box or run "document.getElementById("text_input")" on page load or something. Your code currently doesn't work because "text_input" is not defined when you call it on line 2. EDIT: Putting "document.getElementById("text_input")" inside a function and calling it later (after defining the element "text_input") also works.
  14. I am looking for a way to change the default settings for HTML tags such as h1,h2,p and so on. Going through their documentation, I only seem to have found the how to add/remove format options from the format list on the menu bar, but I haven't managed to actually change what those formats represent. Essentially, I want to change the default #333 h1 to a different color, font, size and so on. Any help with this is much appreciated, thanks!
  15. This is perhaps one of the best browser games out there.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.