Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

unexpected T_OBJECT_OPERATOR (PHP)

Empfohlene Antworten

Veröffentlicht

Hallo und guten Tag,

Die Sonne scheint und ich muss mich hier mit folgendem Problem rumärgern.

Ich habe die Template-Engine Smarty auf angemietetem Webspace installiert.

Ich habe nun die Klasse "Smarty" instanziert und der neuen Klasse den

Namen: MySmarty gegeben:

Der Code für die Instanzierung: (MySmarty.class.php)


<?php

define('PFAD','/smarty/');

require (PFAD.'Smarty.class.php');

class MySmarty extends Smarty
{
function MySmarty() {

this -> Smarty();
this -> template_dir=PFAD.'templates/';
this -> config_dir=PFAD.'configs/';
this -> compile_dir=PFAD.'templates_c/';
this -> cache_dir=PFAD.'cache/';
}
}
?>

[/PHP]

außerdem benötige ich noch folgendes Script: (smartie.php)

[PHP]

<?php
error_reporting(E_ALL);

include('Smarty.class.php');
// Die Smarty-Klasse laden

$smarty = new Smarty;

// Neues Objekt erstellen
echo("foobar");
?>


<!--nun die Instanzierung-->

<?php

require('MySmarty.class.php');


$smarty = new MySmarty;
$smarty->assign ('title','Hallo Welt');
$smarty->assign('text','Unsere Erste Site');

$smarty->display("eins.tpl");

?>

Wenn ich jetzt "smartie.php" aufrufe, wird folgende Fehlermeldung ausgegeben:

unexpected T_OBJECT_OPERATOR in /smarty/MySmarty.class.php on line 10

Sinngemäß heißt das doch, das diese Operation nicht unterstützt wird, oder?

Zeile 10 ist diese:


this -> Smarty();
[/PHP]

Ich hoffe, jemand kann mir helfen und bin für jeden Tip dankbar :rolleyes:

Anstatt this muss jeweils $this stehen.

Vielen Dank für die schnelle Reaktion. Werds heut abend gleich mal ausprobieren

:)

Eigentlich hätte ich selbst drauf kommen müssen, aber wahrscheinlich hat die Hitze geschadet :beagolisc

Vielen Dank nochmal...

Jake

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.