Dev-Umgebung: Kompatibilität für PHP 8.3 + Smarty 4.5.6

- Smarty 4.1.1 → 4.5.6 (behebt dynamic property deprecations)
- Core-Klassen: #[\AllowDynamicProperties] für Admin_role, base, Config,
  Customer, Customer_group, CustomerGroups, Item, Structure, website
- website.class.php: counts[parent_id] initialisieren vor ++ (PHP 8.1)
- layout.class.php: HTTP_ACCEPT_LANGUAGE mit isset-Guard
- website_init.php: session_status()-Check vor session_start
- .htaccess: HTTPS-Redirect via X-Forwarded-Proto (statt SERVER_PORT)
- themes/easyshop_advanced/media/: Parent-Theme-Assets nachgezogen
- .gitignore: smarty.4.1.1.bak ausschließen
This commit is contained in:
Thomas Bartelt
2026-04-20 01:19:01 +02:00
parent d504f8a05d
commit 0a669704ea
598 changed files with 27139 additions and 474 deletions
@@ -0,0 +1,84 @@
assign()
assign variables/objects to the templates
Description
===========
void
assign
mixed
var
void
assign
string
varname
mixed
var
bool
nocache
You can explicitly pass name/value pairs, or associative arrays
containing the name/value pairs.
If you pass the optional third `nocache` parameter of TRUE, the variable
is assigned as nocache variable. See
[`Cacheability of Variables`](#cacheability.variables) for details.
> **Note**
>
> When you assign/register objects to templates, be sure that all
> properties and methods accessed from the template are for presentation
> purposes only. It is very easy to inject application logic through
> objects, and this leads to poor designs that are difficult to manage.
> See the Best Practices section of the Smarty website.
<?php
// passing name/value pairs
$smarty->assign('Name', 'Fred');
$smarty->assign('Address', $address);
// passing an associative array
$smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska'));
// passing an array
$myArray = array('no' => 10, 'label' => 'Peanuts');
$smarty->assign('foo',$myArray);
// passing a row from a database (eg adodb)
$sql = 'select id, name, email from contacts where contact ='.$id;
$smarty->assign('contact', $db->getRow($sql));
?>
These are accessed in the template with
{* note the vars are case sensitive like php *}
{$Name}
{$Address}
{$city}
{$state}
{$foo.no}, {$foo.label}
{$contact.id}, {$contact.name},{$contact.email}
To access more complex array assignments see
[`{foreach}`](#language.function.foreach) and
[`{section}`](#language.function.section)
See also [`assignByRef()`](#api.assign.by.ref),
[`getTemplateVars()`](#api.get.template.vars),
[`clearAssign()`](#api.clear.assign), [`append()`](#api.append) and
[`{assign}`](#language.function.assign)