HIX Vrs.1.3
View management
---
I've finished the first part of HIX Style, and anyone who needs it can now use the new view manager. Following in the footsteps of the big systems, I've decided to implement one that takes the best features from others like Blade, Twig, Smarter,...
It's really necessary to keep moving forward. Whoever doesn't need it and feels comfortable continuing to create views the natural way, they can still do that.
Basically: We have to learn to separate the logic from our view. Our logic will be in the controller, and that will be our harbor. Once we've processed our data in the controller, we'll send it to our view so it can render it. This way, by separating the business logic (Controller) from the presentation layer (View - HTML), maintenance becomes way easier. And now with AI stepping in as support, we can tell it not to touch our logic (Harbor) and instead focus only on touching the view.
Simple, practical example
Controller: test.prg
function main()
LOCAL aData := {;
{ 'Mountain', .t., 5 },;
{ 'Sea' , .f., 2 },;
{ 'City' , .f., 1 },;
{ 'Forest' , .t., 5 },;
{ 'Desert' , .f., 4 },;
{ 'River' , .f., 2 };
}
retu UView( 'test.html', aData )View: test.html
@args aItems
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test HixStyle</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<div class="container py-5">
<div class="text-center mb-5">
<h1 class="display-6 fw-semibold text-secondary">Popular places this holiday</h1>
<p class="lead text-muted">Example of handling view directives with HIX</p>
</div>
@foreach oItem in aItems
@if oItem[2]
<div class="alert alert-success" role="alert">
<b>{{ oItem[1]}}</b><br>
Popular {{ Stars( oItem[3] ) }}
</div>
@else
<div class="alert alert-dark" role="alert">
<b>{{ oItem[1]}}</b><br>
Popular {{ Stars( oItem[3] ) }}
</div>
@endif
@endforeach
<hr>
</div>
@prg
function Stars( n )
// Your proc...
retu Replicate( 'â', n )
@endprg
</head>
</html>
Start HIX, create these two files, and you'll see how easy it is to use views now.
---
More information in the Wiki
---
https://httpd2-blogspot-com.translate.goog/2026/03/hix-style-standard-way.html?_x_tr_sl=es&_x_tr_tl=en
---
"...programar es fĂĄcil, hacer programas es difĂcil..."
UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix