Replies: 2 comments 1 reply
-
Interesting. And I suppose you are worried about speed or memory usage? Why not simply use |
Beta Was this translation helpful? Give feedback.
1 reply
-
You might consider not using smarty->fetch inside the block function handler if it's only a simple tag. But otherwise I suppose this is fine. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are using Smarty for our UI in our platform which is very complex, used by thousands of users per hour, and we're looking for a way to uniformize a bit more our UI by creating some sort of component sets.
We did this for a couple of elements, for example Buttons, Text Inputs and complex elements by using the
registerPlugin
to register manyblocks
andfunctions
.For example, using the following in our Smarty templates:
Will run this:
Results in:
With this, we make sure that all our buttons will look the same, but I get the impression we are overusing the
registerPlugin
and$smarty->fetch
functions even for some things that could be simple.This was most notable when today we had to implement a
Card
element. The Card itself could be really simple, but it may have anheader
,content
andactions
elements inside of it.So, for example, to get the following HTML
We would simply do the following to make sure all our cards would look the same:
It does look better, but I don't know if it feels right to do so many
$smarty->fetch
to in the end, draw only a couple<div>
elements...Is there any better way of doing it or any suggestion?
Beta Was this translation helpful? Give feedback.
All reactions