admidio
admidio copied to clipboard
Understandment Questions to Smarty integration
Admidio utilizes Smarty but only for parts of the Views... thereby theme customization provides only restricted possibilies to change the display of the different Module views.
Why is the design like that?
Question also applies for the language files... shouldnt it be possible to tweak them via a theme and not by changing the "core" Code?
That is because of the history of Admidio. First we don't had any theme customizition. Later we added it and implement it, were it was easy. If I would start new with Admidio I would implement a better more integrated way of Smarty.
But if there is time or someone who want's to push the integration of Smarty, it would be very nice.
I did not do PHP for a longer time now and yet I have problems to find my way thru the Sourcecode but ill keep this in Mind and may encouple parts into the theme.
Please start with small parts so we can have a view how this could be best implemented. Later we can than add more parts.
Hey all, I have started to do this as well. My idea is to extend the "HtmlElement extends \Smarty" and add a Render Method in it:
public function render($templateName, $asigns) {
global $gL10n;
foreach($asigns as $key => $asign) {
$this->assign($key, $asign);
}
$this->assign("ADMIDIO_URL", ADMIDIO_URL);
$this->assign("FOLDER_LIBS_SERVER", FOLDER_LIBS_SERVER);
$this->assign("data", $asigns);
$this->assign('l10n', $gL10n);
return $this->fetch("sys-template-parts/".$templateName.'.tpl');
}
I have started with a HTMLForm part for testing which would look like this:
public function addInput($id, $label, $value, array $options = array())
{
...
$optionsAll["attributes"] = $attributes;
$this->addHtml($this->render("form.input", $optionsAll));
}
So at the end we are just calling all the "add*" Methods as they are for now, but we will render all that stuff in a Smarty template.
What do you think about that idea? I have committed this to my fork: https://github.com/marchorst/admidio/commit/989b5f228f01c80edadb85e9ed51f3dfdc5949d4
For me that looks like an implementation of my basic theoretical idea to aproach this; it does not change that much of the logic while uncoupling the template parts
Would be great if you could also check which parts I have missed so far @Galileon-venta Thanks, Marc