Anyone here using template engines instead of pure HTML?

Discussion Of All Legal Topics Is Fine Anything Goes. Be Respectful of Others. No Personal Information or Attacks.
All Traffic, Link, Banner, Push Notification and Advertising, Offers & Requests Here,.
Domains & Websites For Sale and Requests Here.
Keep One thread per person & No More Than 1 Weekly Bump.
Post Reply
sebflo
Verified Member
Verified Member
Posts: 138
Joined: October 9th, 2018, 1:16 pm

Anyone here using template engines instead of pure HTML?

#1

Post by sebflo » October 18th, 2018, 3:20 pm

I generally use HTML and SCSS or CSS. However I have worked on a few projects that use Blade or Twig template engines. Gotta say Its very clean and easy to write, but its taken a bit of getting used to with my development workflow.

Anyone use a template engine for their projects? What are your thoughts?




User avatar
Kev
Verified Member
Verified Member
Posts: 534
Joined: March 3rd, 2018, 11:07 am

#2

Post by Kev » October 18th, 2018, 4:47 pm

I use htnl5 now




User avatar
koster
Verified Member
Verified Member
Posts: 954
Joined: June 25th, 2018, 4:42 am
Contact:

#3

Post by koster » October 19th, 2018, 4:37 pm

css confuses the hell out of me. I am fighting with my blog css's all the time.




sebflo
Verified Member
Verified Member
Posts: 138
Joined: October 9th, 2018, 1:16 pm

#4

Post by sebflo » October 19th, 2018, 4:49 pm

koster wrote: ↑
October 19th, 2018, 4:37 pm
css confuses the hell out of me. I am fighting with my blog css's all the time.
Keep me in mind if you ever need help with it.




Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#5

Post by Colmike7 » October 19th, 2018, 5:14 pm

Same here, just post a thread with any CSS questions. ^
Keep things simple, read up on CSS things when you have down time, inspect element on FF is very useful for debugging and testing, coding things from scratch rather than modifying someone else's code makes things a lot easier in the long run although there's more time involved, etc.




calista
Verified Member
Verified Member
Posts: 1985
Joined: February 20th, 2018, 6:15 pm
Title: Manila Babe

#6

Post by calista » October 21st, 2018, 9:40 am

CSS is the only way for me, it is so intuitive once you get a handle on it.




greatpornlinks
Verified Member
Verified Member
Posts: 1715
Joined: June 14th, 2018, 6:51 pm

#7

Post by greatpornlinks » October 22nd, 2018, 11:01 am

sebflo wrote: ↑
October 18th, 2018, 3:20 pm
I generally use HTML and SCSS or CSS. However I have worked on a few projects that use Blade or Twig template engines. Gotta say Its very clean and easy to write, but its taken a bit of getting used to with my development workflow.

Anyone use a template engine for their projects? What are your thoughts?
Share some pros and cons please
Never have your honey where you make your money.
~ HeidiHoe 2023

User avatar
koster
Verified Member
Verified Member
Posts: 954
Joined: June 25th, 2018, 4:42 am
Contact:

#8

Post by koster » October 23rd, 2018, 3:52 pm

Negative I am a html type of webmaster myself.




Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#9

Post by Colmike7 » October 23rd, 2018, 3:56 pm

I don't like fat code.. :)




sebflo
Verified Member
Verified Member
Posts: 138
Joined: October 9th, 2018, 1:16 pm

#10

Post by sebflo » October 23rd, 2018, 4:04 pm

koster wrote: ↑
October 23rd, 2018, 3:52 pm
Negative I am a html type of webmaster myself.
What do you develop in?




sebflo
Verified Member
Verified Member
Posts: 138
Joined: October 9th, 2018, 1:16 pm

#11

Post by sebflo » October 23rd, 2018, 4:04 pm

Colmike7 wrote: ↑
October 23rd, 2018, 3:56 pm
I don't like fat code.. :)
Yea neither do I. I stay away from a lot of frameworks because of this.




Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#12

Post by Colmike7 » October 23rd, 2018, 4:10 pm

sebflo wrote: ↑
October 23rd, 2018, 4:04 pm
Colmike7 wrote: ↑
October 23rd, 2018, 3:56 pm
I don't like fat code.. :)
Yea neither do I. I stay away from a lot of frameworks because of this.
Me too. I'll end up starting with even a simple framework like Bootstrap, then when I'm done I go in and clean up, then afterwards I'm like "I didn't need a framework for this..." lol




sebflo
Verified Member
Verified Member
Posts: 138
Joined: October 9th, 2018, 1:16 pm

#13

Post by sebflo » October 23rd, 2018, 4:33 pm

Colmike7 wrote: ↑
October 23rd, 2018, 4:10 pm
sebflo wrote: ↑
October 23rd, 2018, 4:04 pm
Colmike7 wrote: ↑
October 23rd, 2018, 3:56 pm
I don't like fat code.. :)
Yea neither do I. I stay away from a lot of frameworks because of this.
Me too. I'll end up starting with even a simple framework like Bootstrap, then when I'm done I go in and clean up, then afterwards I'm like "I didn't need a framework for this..." lol
Yea I use bootstrap quite a bit, I dont like to use pre-made bootstrap templates though as they are usually pretty messy.

I usually stay away from heavy development frameworks like Laravel or Zend.

Template engines have quite a few benefits. Still though I usually stick with HTML5 and SASS or CSS3.

However Template engines can complement HTML5 and CSS3.

For example take the following.

Twig Username output to div

Code: Select all

<div>
{% for user in users %}
    * {{ user.name }}
{% else %}
    No users have been found.
{% endfor %}
</div>
Compared to a core php version

Code: Select all

<div>
<?php if($users): ?>
    <?php foreach($users as $user): ?>
        <?= $user['name']; ?>
    <?php endforeach; ?>
<? else: ?>
    No users have been found.
<?php endif; ?>
</div>
Sure not the only way to get the result but look at how clean the twig version looks compared to the core php version.




Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#14

Post by Colmike7 » October 23rd, 2018, 5:36 pm

sebflo wrote: ↑
October 23rd, 2018, 4:33 pm
Colmike7 wrote: ↑
October 23rd, 2018, 4:10 pm
sebflo wrote: ↑
October 23rd, 2018, 4:04 pm


Yea neither do I. I stay away from a lot of frameworks because of this.
Me too. I'll end up starting with even a simple framework like Bootstrap, then when I'm done I go in and clean up, then afterwards I'm like "I didn't need a framework for this..." lol
Yea I use bootstrap quite a bit, I dont like to use pre-made bootstrap templates though as they are usually pretty messy.

I usually stay away from heavy development frameworks like Laravel or Zend.

Template engines have quite a few benefits. Still though I usually stick with HTML5 and SASS or CSS3.

However Template engines can complement HTML5 and CSS3.

For example take the following.

Twig Username output to div

Code: Select all

<div>
{% for user in users %}
    * {{ user.name }}
{% else %}
    No users have been found.
{% endfor %}
</div>
Compared to a core php version

Code: Select all

<div>
<?php if($users): ?>
    <?php foreach($users as $user): ?>
        <?= $user['name']; ?>
    <?php endforeach; ?>
<? else: ?>
    No users have been found.
<?php endif; ?>
</div>
Sure not the only way to get the result but look at how clean the twig version looks compared to the core php version.
That's pretty neat, I might look into Twig more. For a while I thought it was more of a macro kind of thing to make PHP seem easier, and why I never really paid attention to it, but it's more like separating the logic with the PHP and front end display code, which can make big projects and changes easier and quicker. Or to give a designer the front end part and not have to worry about getting lost in someone else's PHP.
I do like regular PHP a lot, though, so it might still be hard to persuade me to use something else lol.

I agree with the heavy frameworks, too. Sure, I can read a ton and learn another way to do the same thing with something a little fancier, but why would I want to if I don't need to for the same end result?




sebflo
Verified Member
Verified Member
Posts: 138
Joined: October 9th, 2018, 1:16 pm

#15

Post by sebflo » October 23rd, 2018, 6:25 pm

Colmike7 wrote: ↑
October 23rd, 2018, 5:36 pm
sebflo wrote: ↑
October 23rd, 2018, 4:33 pm
Colmike7 wrote: ↑
October 23rd, 2018, 4:10 pm


Me too. I'll end up starting with even a simple framework like Bootstrap, then when I'm done I go in and clean up, then afterwards I'm like "I didn't need a framework for this..." lol
Yea I use bootstrap quite a bit, I dont like to use pre-made bootstrap templates though as they are usually pretty messy.

I usually stay away from heavy development frameworks like Laravel or Zend.

Template engines have quite a few benefits. Still though I usually stick with HTML5 and SASS or CSS3.

However Template engines can complement HTML5 and CSS3.

For example take the following.

Twig Username output to div

Code: Select all

<div>
{% for user in users %}
    * {{ user.name }}
{% else %}
    No users have been found.
{% endfor %}
</div>
Compared to a core php version

Code: Select all

<div>
<?php if($users): ?>
    <?php foreach($users as $user): ?>
        <?= $user['name']; ?>
    <?php endforeach; ?>
<? else: ?>
    No users have been found.
<?php endif; ?>
</div>
Sure not the only way to get the result but look at how clean the twig version looks compared to the core php version.
That's pretty neat, I might look into Twig more. For a while I thought it was more of a macro kind of thing to make PHP seem easier, and why I never really paid attention to it, but it's more like separating the logic with the PHP and front end display code, which can make big projects and changes easier and quicker. Or to give a designer the front end part and not have to worry about getting lost in someone else's PHP.
I do like regular PHP a lot, though, so it might still be hard to persuade me to use something else lol.

I agree with the heavy frameworks, too. Sure, I can read a ton and learn another way to do the same thing with something a little fancier, but why would I want to if I don't need to for the same end result?
Yea twig is pretty sweet, definitely not needed but it does help separate php or similar from html.

Blade is a nice template engine too and is used a lot with laravel.

Yea frameworks like laravel or codeigniter are pretty heavy. I do use them but only when in large teams.

When working with teams I take the following approach.

Front End: Template Engine
Back-end: Laravel or Codeigniter
Database: Stored Procedures

I use this structure because when working on a large team you never know when some one is going to quit or not work out, because Laravel and codeignite have pretty strict rules as far as structures goes, its very easy to have another developer take over a task.

I use Stored procedures to separate database queries from in code queries, so as a database admin I have full control of the queries and can store them. When developers need to access data from a query they can just call a stores procedure.

For example

Code: Select all

$query = $database->prepare("SELECT * FROM table WHERE id = ?");
$query->execute(array($param));
$query = $query->fetchAll(PDO::FETCH_ASSOC);
return $query
Here is what the stored procedure would look like

Code: Select all

$query = $database->prepare("CALL: get_all(?)"); //Stored procedure is called
$query->execute(array($param));
$query = $query->fetchAll(PDO::FETCH_ASSOC);
return $query
Better yet you can turn the request into a lambda request and just have the lambda return json from the database.

I use this so the developers don't touch the database and just focus on logic.

The front-end guys can then simply access the data returned by the logic and simply output the results with a template engine.

When working alone I tend to do something similar but with less restrictions as it's just me doing front-end, backend, and database work.

Its not the only way to do things, just kinda the way I like to work when it comes to working with team members.




Anyone here using template engines instead of pure HTML?

Post Reply