Jump to content

makuc

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Everything posted by makuc

  1. Heh, finally back here . So i have a question. this time about HTML and CSS =P . I want to build a menu, which have for links text, not images, so that it would depend on the language what it should show Of course I know how to make that, otherwise I wouldn't even start But there is a little problem I am facing now. How could I bring text in <a> tags like 5px higher than it's current position? Because if I use <div>, it start breaking my whole design, if it is not live preview (i am using dreamweaver cs5.5 for previewing purposes =P ). Is there any other way to to make the text appear a littl ehigher? Thanks.
  2. Basically I think all you need is this: http://phpsnips.com/snippet.php?id=61[ I think a way simpler than any rendering engine
  3. And what if I don't want that anyone would be modifyint the code again? Ok, I'll try to fix these :'(
  4. What do you mean by bad naming? Could you give me some examples (because this is naming I am used to, even from naming my documents files on my computer)? And could you, please, post some improvements to the code (perhaps just a piece of code) to show me what exactly do you mean? Any advice (or even a little more explained) is very welcome .
  5. Since my clock is finished (in case I won't integrate external configuration file), I decided that it would be good if an expert would look at my code, since this is my first "program" (script) xD. So, here it is: <?php $seconds = date(s); $minutes = date(i); $hours = date(H); $dayweek = date(w); $day = date(d); $month = date(m); $year = date(Y); $dayadd = date(S); ?> <script type="text/javascript"> <!-- /********************************************************** *****|_______________________________________________|***** *****|...............................................|***** *****|............Cybital Inc. Production............|***** *****|...............................................|***** *****|................Proudly presents:..............|***** *****|....PHP & JavaScript Real-Time Server Clock....|***** *****|...............................................|***** *****|...The only JS and PHP Real-Time Server Clock..|***** *****|...without any use of AJAX which would cause...|***** *****|..additional server overloading while it would.|***** *****|.......keep requesting time from server........|***** *****|.So here it is, Real-Time Server Clock with NO.|***** *****|..........addition server overloading..........|***** *****|...............................................|***** *****|.......Copyright© Cybital Inc. 2011-<?php echo date(Y);?>.......|***** *****|_______________________________________________|***** **********************************************************/ var s=<?php echo($seconds);?>; var m=<?php echo($minutes);?>; var h=<?php echo($hours);?>; var day=<?php echo($day);?>; var dayWeek=<?php echo($dayweek);?>; var month=<?php echo($month);?>; var year=<?php echo($year);?>; var nextLeapYear=2000; var currentLeapYear=nextLeapYear; function clock(){ s=s+1; if(s==60){ s=0; m=m+1; } if(m==60){ m=0; h=h+1; } if(h==24){ h=0; dayWeek=dayWeek+1; day=day+1; } if(dayWeek==7){ dayWeek=0; } numDaysPerMonth(); dayNaming(); dayDisplay(); monthNaming(); betterSec(); betterMin(); document.getElementById('Clock').innerHTML="<PRE>"+h+":"+betterMinutes+":"+betterSeconds+" | "+dayName+" - "+day+dayadd+" "+monthName+","+year+"</PRE>"; setTimeout("clock()",1000); } function dayNaming(){ if(dayWeek==0){ dayName="Sunday"; } if(dayWeek==1){ dayName="Monday"; } if(dayWeek==2){ dayName="Tuesday"; } if(dayWeek==3){ dayName="Wednesday"; } if(dayWeek==4){ dayName="Thursday"; } if(dayWeek==5){ dayName="Friday"; } if(dayWeek==6){ dayName="Saturday"; } } function dayDisplay(){ if(day==1){ dayadd="st"; } if(day==2){ dayadd="nd"; } if(day==3){ dayadd="rd"; } else{ dayadd="th"; } } function monthNaming(){ if(month==1){ monthName="January" } if(month==2){ monthName="February" } if(month==3){ monthName="March" } if(month==4){ monthName="April" } if(month==5){ monthName="May" } if(month==6){ monthName="June" } if(month==7){ monthName="July" } if(month=={ monthName="August" } if(month==9){ monthName="September" } if(month==10){ monthName="Oktober" } if(month==11){ monthName="November" } if(month==12){ monthName="December" } } function betterSec(){ if(s<=9){ betterSeconds="0"+s; } else{ betterSeconds=s; } } function betterMin(){ if(m<=9){ betterMinutes="0"+m; } else{ betterMinutes=m; } } function numDaysPerMonth(){ if(month==1){ if(day==32){ day=1; month=month+1 } } if(month==2){ if(nextLeapYear<year){ nextLeapYear=nextLeapYear+4 } if(nextLeapYear==year){ if(day==30){ day=1; month=month+1; } } else if(day==29){ day=1; month=month+1 } } if(month==3){ if(day==32){ day=1; month=month+1 } } if(month==4){ if(day==31){ day=1; month=month+1 } } if(month==5){ if(day==32){ day=1; month=month+1 } } if(month==6){ if(day==31){ day=1; month=month+1 } } if(month==7){ if(day==32){ day=1; month=month+1 } } if(month=={ if(day==32){ day=1; month=month+1 } } if(month==9){ if(day==31){ day=1; month=month+1 } } if(month==10){ if(day==32){ day=1; month=month+1 } } if(month==11){ if(day==31){ day=1; month=month+1 } } if(month==12){ if(day==32){ day=1; month=month+1 } } } --></script> <meta charset="iso-8859-1" /> <div>Current server time is:<br /> <div id="Clock">Here should be shown Server Clock! Check if you have JavaScript enabled!</p> <script type="text/javascript"> clock(); </script> So, that's all. Any help would be appreciated.
  6. Don't bother. I figure out that I have to change else to else if . Thanks anyway. Now my clock is completely finished. The only thing I might integrate later on is external configuration file for personalizing how clock is shown (you can change the sequence to match your way of view - where is shown: day, where month, year etc.). And my latest clock even know when February have 28 and when 29 days . I have been bothering my head with that for very long time . You can preview it at: http:cybital.cu.cc/clock.php
  7. <script type="text/javascript"> <!-- function numDaysPerMonth(){ if(month==1){ if(day==32){ day=1; month=month+1 } } if(month==2){ if(nextLeapYear<year){ nextLeapYear=nextLeapYear+4 } if(nextLeapYear==year){ if(day==30){ day=1; month=month+1; } } else(day==29){ day=1; month=month+1 } } if(month==3){ if(day==32){ day=1; month=month+1 } } if(month==4){ if(day==31){ day=1; month=month+1 } } if(month==5){ if(day==32){ day=1; month=month+1 } } if(month==6){ if(day==31){ day=1; month=month+1 } } if(month==7){ if(day==32){ day=1; month=month+1 } } if(month=={ if(day==32){ day=1; month=month+1 } } if(month==9){ if(day==31){ day=1; month=month+1 } } if(month==10){ if(day==32){ day=1; month=month+1 } } if(month==11){ if(day==31){ day=1; month=month+1 } } if(month==12){ if(day==32){ day=1; month=month+1 } } } --></script> Can anyone help me? I can't figure out what is wrong in the code. But I know where the error comes in, it is in this part of the code: if(month==2){ if(nextLeapYear<year){ nextLeapYear=nextLeapYear+4 } if(nextLeapYear==year){ if(day==30){ day=1; month=month+1; } } else(day==29){ day=1; month=month+1 } } So, if I remove the if(...){...} and change else to if, it works fantastic. I really want to get this to work. Thanks. PS.: This is just one part of my clock code. If you need to see it whole, feel free to ask.
  8. Does anyone know, how could I make a redirector, or something, that would look if in the same directory exist a file with the same name, but is let say spelled with capital letters or only some of them ... The problem is that in my-early stages of my Real-Time PHP & JavaScript Server Clock, I have been previewing it with a file name Clock.php (capital c), but since I didn't want it to be affected by my spelling errors in kode (yea, it wasn't working all the time ... ) i change the name for testing purposes. But then, when I think that it can be published, I changed the name back to clock.php, but forget to make first c capital and since I wanted to put the link there one more time, I copy and paste it again ... and I really don't want to have multiple files on server . Thanks.
  9. Well, thank god that I have just read there some infos about specified peaces of code from different cheat sheets , nothing more But thank you for warning, since I was just about to start reading a lot more there . And thank you for all links. They will come in handy, you can be sure about that . Thorpe, thanks for that tip ... I'll test it soon, after I make some more upgrades to the clock (so it will specify how many days a month have, before it break and start counting in a new, than when February have 28 and when 29 days, etc.). So yea, thanks for the tip.
  10. @Daniel0 Do you know for any good book of PHP and JavaScript that are good for start? Because for now I have been studying from cheat sheets only (since I left PHP and MySQL Bible ) and of course uncle Google . http://w3school.com/ is pretty good for a start at least from my opinion. This discussion was opened for helping to start with programming for noobs, like I am, so if anyone know for any good resources for PHP and JavaScript, the reply here is VERY welcome . And thanks for all your replies and help until now. With your help I was able to finish my first project using PHP and JS (and let's not mention that I have already give up with it once ), so keep it up .
  11. Thanks. I didn't know, that JavaSript will get executed itself only if it is placed under the first line written in HTML (which is automatically body tag), so thank you very much. And my Server Clock is finally finished! It is completely independent from the user clock which I really didn't expect . But yes, here it is, real-time server clock. The latest link to it is already in my previous post and since I don't know how long will it be there (I'll try to keep it that way as long as I can ), otherwise, if anyone need it, please pm me. BTW, here is link to it one more time: http://cybital.cu.cc/clock.php
  12. Is there any way that I could start function from JavaScript without using body onLoad ? Because I really want to make the whole thing simpler to integrate to anyones website, so he wouldn't have to much trouble if he would already have any body onLoad function set already :-\ . So all he would do is set an id="clock" where he want the clock to appear . Thanks in advance. PS. How can I edit any of my earlier posts? Because after some minutes, the button edit just disappear.
  13. You don't need to understand the first part of my post to become a PHP programmer. I only touched the tip of the iceberg. If you find it interesting and you'd like to learn about compiler theory, I would recommend you to read a book or take a course on compilers (the latter would likely include the former as well though). I'm a computer science student, so compiler and formal language theory are some of the subjects I deal with, but you don't need to become a computer scientist to become a web developer. I don't expect you to understand all of it at this point, but there should be enough keywords for you to research should you decide to look at it further. An understanding of the HTTP protocol is pretty essential if you want to become a web developer though, even if you at first only have a rudimentary understanding of it. Hmmm, interesting, I am actually getting interested in reading PHP and MySQL Bible again after all (i have started, but after that decided that 1400 pages is a way too much ). What do you think of my clock? I have actually just implemented in minutes so hours are coming soon, too . You (and anyone else interested in it) can check it on: http://cybital.cu.cc/clock.php
  14. And could anyone take a look at this clock and try to modify it so it will increase the time and not decrease? http://x10gaming.com/ I guess that I wouldn't have to one myself and with help of all of you, of course PS.: @Daniel0 from your post, I can see that I still have a long way to go . But I must admit, your post is really helpful for my basic PHP understanding.
  15. This is what I have so far : <?php $sec = date(U); $seconds = date(s); $minutes = date(i); $hours = date(H); $day = date(d); $dayweek = date(w); $months = date(m); $year = date(Y); ?> <script type="text/javascript"> var s=<?php echo($seconds);?>; var t; var secCounter_is_on=0; function seconds() { document.getElementById('Clock').innerHTML="Current seconds are: " + s; s=s+1; t=setTimeout("seconds()",1000); } function secStart() { if (!secCounter_is_on) { secCounter_is_on=1; seconds(); } } </script> <body onLoad="secStart()"> <p id="Clock">Server seconds should be shown here!</p> Please, tell me what you think, and please post any ideas how should I make it auto increase minutes once seconds are <= 60. PS.: You can preview it at: http://cybital.cu.cc/Clock.php
  16. Hmmm, interesting. When I have been playing around with register script, written in php, and I put the header on the top, it just didn't do anything in the database (MySQL). That's why I ask here. Of course there was another error in the code somewhere, but as fast as I remove the header from the top, it at least create a database (and I am 99.9% sure that I DID NOT create it!). So right now I am kind of confused. Sorry, I haven't read your post yet, but I will. I just flow over it a little and find out these . So thanks for your reply. I'll check it later on for a complete analyze .
  17. I know, that's why I am trying to make one . And I would really appretiate any help with that . *********************************************************************************************************** But for today I have enough studying . See you all tomorrow. And if anyone could write JS for something like that, I would be really greatfull. Otherwise, I think I will revive this project tomorrow and keep you updated. PS. Thanks for your advice, Ignace. I'll keep that in mind, tommorow. xD
  18. Actually I didn't mean it like that ... Since PHP can't make realtime showing clock from server time (all it does is collect the infos at the time when it is executed), I would want that JS detect whenever there is a change in seconds on the user machine (the value of change doesn't matter, just that there is a change) and it would update (perhaps I just tell it wrong) the time that PHP gives at the beginning. Perhaps there should be some more different values (more separated, I mean) give from PHP like seconds by themselves, minutes, hours etc. And then they all get merged in JS. It's just that let's say I manage to get my site pretty known with quiet some traffic (let's hope so) and the fact that for now I am on sharing server ... you know what I mean, so I don't really like to make too overloading for nothing to the server itself using AJAX, to rapidly execute the part of code. So yea, that is basicly what I am up to . It's just that user can change his clock and I really don't want that to affect the clock on my site .
  19. Before I started with my registration script, I have been trying with real-time server clock. I know that PHP gets calculated once, only, and after that nothing happens with it until the page refresh. I have heard that something like real-time clock could be done using AJAX, but I also heard that if a lot of users would be visiting a webpage, something like that would make server overloading, after some time. So here is my question ... Is there really no other way to do it? Because I have been thinking: JavaScript is calculated in local (user) PC and yes, I know, that all that JS can get is some local data, but if someone make JS keep tracking seconds only and even those just when they change, nothing more, it could change the time of server time, got by PHP. Something like that: PHP get some data from server like <?php $serverTime = date(...);?> After that, JS comes in: <script language=javascript><!-- function RealTimeClock() { var serverTime=<?php echo($serverTime);?> .....some code i don't know about, but as I said, it would track local time seconds (only) changes (no matter if they rise or lower) and whenever a change is done, it rises server time SECONDS for 1. After that with some more JS code it would auto calculate once seconds are higher that 60, it auto rise minutes for 1 and so on ..... } --></script> As I said, I have been studying PHP for a little (I am still a noob ), but I have not even a clue about JS, so any help would be appretiated. Thanks in advance.
  20. Thanks for your fast reply ... I am glad that my thinking was right. Well, too bad that that's it for today...I have to get some sleep now. Well, more questions coming tomorrow. Thanks again. I'll sleep a way better now .
  21. Hi. My name is Armin and what can I say? I am new to php and I am self teaching ... Yea, you get what I mean. So I have some basic noob questions. First off: I have been playing around with my code a little and suddenly find out that I have to ask something that I am not that sure about. So the thing is (english is not my primary language, so if anyone would need any more explanation about what I mean, please ask me to!) ... so, does PHP code gets calculated line by line? Because I have been playing around with registering script and I came out that if I place header redirection at the beginning of the code none of the code under it gets processed (meaning that form elements doesn't get send to the MySQL database). So I haven't tried about putting it at the end yet, because as I said, I want to be sure about that for future coding . Once this BIG question is resolved, I'll post another one . Thanks in advance. PS. If anyone want to see what I mean, feel free to ask .
×
×
  • 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.