Jump to content

GrooN

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    jenskro@hotmail.com
  • Website URL
    http://groondev.com/

Profile Information

  • Gender
    Male

GrooN's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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).
×
×
  • 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.