Jump to content

GrooN

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by GrooN

  1. A syntax looking/feeling better than another syntax depends on the person, otherwise why would there be so many different programming languages? Anyway, it would be incorrect to state that I only use templates myself, in fact I am a loyal CodeIgniter user, which as you may know use the MVC design pattern. The purpose of this thread was simply to provoke people a little, and get some opinions toward Template Engines.
  2. True, it is generally poor coding, and tools probably won't help... It's just sad then.
  3. Interesting, I just wanted to see what opinions people had and so far I've got one, so I am very satisfied. To be honest I cannot myself come with any counter arguments other than keeping the HTML and PHP apart, which, if your designer is able to perform simple loops and conditionals, is rather irrelevant, as long as you keep it at a minimum. The thing that really scares me, is when people throw all their algorithms and computations inside the same document as the HTML code itself.
  4. Lol, that's gotta be demotivating Looks cool anyway, also very well documented ^^
  5. True there is definitely a performance barrier, but using the PHP inside the HTML can easily become unmanageable. I see your argument with the MVC pattern, adjusting the variables in the controller before sending them to the viewer. But still the benefit of a simpler formatting gotta kill the performance issue. Anyway it would be acceptable on a smaller project, but I just can't help seeing the pros overcoming the cons in projects of larger scale. What is your personal preference Thorpe?
  6. Recently I’ve noticed that wherever you go, whatever project you take a look at, 50% of them don’t take the path between PHP and HTML serious. They embed PHP directly in their HTML code. Back when PHP was a little squishy language, it was merely considered a kind of template engine, and it was common practice to combine PHP and HTML in a single file. Now PHP has developed to a powerful scripting language, and it is now capable of performing even difficult computations with decent performance. This development of PHP results in more complex algorithms and thereby more code, and mixing this with HTML can produce a whole bunch of spaghetti code, and it is therefore considered bad practice. Because of this it is more usual to use what is known as template engines, whose goal is to make the transformation from PHP to HTML as smooth as possible. The basic principle is to make an even simpler scripting language (than PHP) to mix with the HTML, and thereby increase the readability, and also give designers who do not know of PHP a chance to design with as much ease as possible. Out on the template engine market, there are so many tasty engines to choose between (such as Smarty, PHPTAL, Rain TPL, XTemplate etc.). And even with a so big market, I still see serious projects which do not harvest the power this gives, why is this, can’t people get on? – are they stuck in the good old days? TLDR; why doesn’t people use template engines? (And... If you've understood the importance of Template Engines, which is your favorite?)
  7. With apache working as your server client it is not possible to have both PHP and SSI code in a single file, it is either PHP or SSI. But there is always a way to get around limits, and the solution in this situation is that you can include PHP from SSI: <!--#include virtual="executeMe.php" --> But that can easily become messy, and I do not recommend doing it. Choose one solution, and stick with it ^^
  8. Okay, fail, why the fuck is PHP so freaking flexible!? - it would still work... anyway, you should still change what I told you, just prettier, at least in my opinion.
  9. first of all, please don't use quote every time you pass a variable, definitely no need to recast your variables to strings twice. This leads me to your mistake, you write: mail("$getlist3[email]","$subject","$nletter",$headers); it should be: mail($getlist3['email'],$subject,$nletter,$headers);
  10. You can either use the rather simple way, of redirecting the user from the page. // Places after sessions, but before all the other code. header("Location: ../index.php"); exit; // stop page execution Else you can use .htaccess, to redirect user http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
  11. You can send it as a header directly from PHP, or as a meta tag in your HTML head. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> header("Content-Type: text/html; charset=UTF-8");
  12. If you don't need to append to the file you should use another mode than "a", try use "w", this will place the pointer in the start of the file, and delete the other content. Try something like this $file_loc = "myfile.txt"; if (file_exists($file_loc)) { $handle = fopen($file_loc, "a") fwrite($handle } else { $handle = fopen($file_loc, "w") fwrite($handle, "the first content\n"); } if ($handle) fclose($handle); I haven't tested it, just a suggestion
  13. You cannot encrypt your php code. PHP runs server-side so your clients will never be able to see the actual PHP code. If you want to encrypt it, to make sure noone will be able to steal your code, this is not possible, it is possible to compress the code, but not to encrypt it (and still be working).
  14. As far as I know UTF-8, supports... well... a lot, of different characters - it should support the language packs you listed Look here for further information: http://www.unicode.org/
  15. For handling database connection you should look at these functions mysql_connect(); mysql_select_db(); mysql_query(); mysql_fetch_array(); To search the columns the function "strpos()" would come in handy, and if you want to make it a bit more advanced you should look at Regular Expressions
  16. Well it is not that complicated, it encodes your object into json format ^^ You can read more about it here: http://php.net/manual/en/function.json-encode.php And when you use json_encode, you should also know json_decode, which does the opposite
  17. Now before reading your code throughout, I have to ask, is there any special reason why you don't use the function json_encode()? ^^ - or did you know if its existence at all?
  18. I have to highlight that I did at no point in my reply, state that it would fix your problem to change it to hexcode ^^, I just came with a tip that you should normally use hexcode I can't find any problems with the syntax right now, try to give me some feed back. Check the value of $color, and the value of the timestamp, to see if they are as you expect them
  19. streetevil I am sorry to say, but I don't know any program capable of giving you the possibility of actually making useful PHP applications without actually touching the source code You'll have to learn PHP, or ASP (.net) (funny how I recommend PHP, isn't it? xD, but I do because it got a very useful manual, and it isn't made by Microsoft , still ASP is just as powerful as PHP^^). Anyway if you actually DO find a program capable of doing what you're requesting... you need to contact me! - just so I can test it, and explain the world how wrong it is xD If you do have any questions about your project, don't hesitate to return to these forums
  20. Badeand, php doesn't recognize the code as red, because php is an interpreted scripting language, that works server-side, meaning: it doesn't actually touch the actual markup at any point. So it is your browser which recognizes the color code, and i do recommend using hex colors, giving you the control of which color to see. The reason why me and Zurev used the nickname for the color is because it looks better when we're showing it to you (not meaning it doesn't work, it is just not recommended). Sometimes the world is just mean xD
  21. Ehm... first wtf? why the curly brackets without any function? Now when you define the variables I wouldn't pass them into a string (quotes), this is possible, but just bad coding. Also when you define your variables, you should think about your naming conventions, ex. since your $message2 contains the password, I would recommend calling it something like $password, $passwrd, $pw, $pass or using the underscore: $data_password, be creative Now to your mail() function, the mail function accepts 4 parameters; to, subject, message and headers. Meaning you've send the password as a header. also as far as my HTML/XHTML knowledge goes, the tag "action" doesn't exist anywhere. My Suggestion Follow this link and start reading: http://www.w3schools.com/html/default.asp (learn html) And when you're done with that you can start with this: http://www.w3schools.com/php/default.asp (learn php) Just to give you a little spoon feeding
  22. If I understand your question right, the rest is just math... $timestamp; // The timestamp you've got from database. $distance = time() - $timestamp; $font['color'] = "black"; if ($distance < (60*60*24*7)) // under 7 days $font['color'] = "green"; elseif ($distance > (60*60*24*14)) // over 14 days $font['color'] = "red"; else // between 7 and 14 days $font['color'] = "yellow"; Quote php manual: "Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)" So all you have to do is multiply the amount of seconds in a minute with the minutes in an hour with the hours in a day and in the end with the number of days
  23. Hehe, you're welcome Merry Christmas ! ^^
×
×
  • 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.