Missing functions in smarty

Oxid version is 4.9.5 currently (local dev. Will be updated before going live).

Is it me or does smarty miss quite a few functions in oxid? For instance, today I ran into a CSS-Problem that leaves me no choice but to add “phantom” elements to fill a container.
It concerns a responsive flexbox container with margins between the items. Basically I need X% + Ypx per item. I have exhausted all options in CSS, since calc()-ing the margin doesn’t work properly in IE.

So I have to loop for X-times, inserting X empty flex-items. X is known so I thought no problem, I’ll just do a for-loop. But apparently the Oxid-version of smarty doesn’t know about for-loops. Or even while-loops. Is there some alternative?

I’ve also noticed several times in the past that functionality mentioned in the official smarty docs simply doesn’t exist in oxid. Though I can’t give an example right now, since I usually could work around it somehow.

The only solution I can think of right now would be putting a custom function in oxcmp_utils that takes an integer and returns an array with that number of elements so I can use a foreach-loop in smarty. But that would be way beyond ugly. Surely there is a better solution?

[Edit]
For now, I used this function in oxcmp_utils to get around the problem:


    public function getArrayOfSize($i = 0) {
    	return array_fill(0, $i, NULL);
    }

I feel really [I]really[/I] dirty using this, so a better way would be much appreciated.

regular version of smarty v2 doesnt know for loops, too.
oxid’s smarty is just regular smarty v2 with changed delimiters. (not v3!)
so you need to refer to the v2 documentation instead of v3

the most similar function would be "section"
http://www.smarty.net/docsv2/en/language.function.section.tpl

I see, thanks! Since I’m used to Smarty v3, I never needed sections before. The solution was simple enough:


[{section name=missingElementsLoop loop=$iMissingElements}]
    [{include file="custom/articlebox.tpl" oArt=false}]
[{/section}]

Is there a particular reason Oxid is not using v3? It’s been around ever since I started having to deal with it, which has been, I don’t know, 4 years?

i have no idea.
Smarty v3 was released anytime in 2010, but oxid is older ( i heard, oxid esales celebrated its 20th birthday 2 years ago). So i guess OXID started with v2 and I can only assume there would be compatibility issues.