Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[software development] File exchange software

#47
I've now officially begun working on the template engine. I found a very simple tutorial online to show me how it's done, and overall I'd say it's worked pretty well on an independent test.

Unlike MyBB, you will actually have to explicitly set template variables in the code. This may make the code a little messier, but it is more secure as it ensures that only data that is explicitly set can be included in a template. Someone can't, for example, include the database password and reveal that through a malicious template. Tongue

For example:

Code:
hello world, [@user]! <br />
Age: [@age].<br />
Occupation: [@occupation]. </br />
Interests: [@Interests] <br />

Would reveal something like:

Quote:hello world, Darthness!
Age: Unknown
Occupation: Restaurant worker
Interests: Lots of stuff!

In the PHP, template variables are set something like this:

Code:
    $templates->set("template_hello", "user", "Darthness");
    $templates->set("template_hello", "age", "Unknown");
    $templates->set("template_hello", "occupation", "Restaurant worker");
    $templates->set("template_hello", "Interests", "Lots of stuff!");
    echo $templates->parse("template_hello");

I have yet to implement this outside of an independent testing environment, but this is what I've got so far, and we shall see how this works. (In case you're wondering, I got the idea to do it using this method from this tutorial, although I'm definitely not following it exactly. Tongue )

Reply


Messages In This Thread
RE: [software development] File exchange software - by lookforuu - September 20th, 2013 at 6:34 PM
RE: [software development] File exchange software - by Acko - January 29th, 2014 at 7:49 PM
RE: [software development] File exchange software - by Acko - January 31st, 2014 at 12:02 AM
RE: [software development] File exchange software - by brian51 - February 18th, 2014 at 1:20 AM
RE: [software development] File exchange software - by Darth-Apple - February 25th, 2014 at 8:38 PM



Users browsing this thread: 6 Guest(s)

Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2024
Forum design by Makestation Team © 2013-2024