Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

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.

Class Problem

Featured Replies

I'm installing the smarty templating system. I'm not familiar with classes and i'm stuck at something. The configuration file has a class with variables for you to assign directory paths to, the problem i have is that i need to assign a variable to one.

 

I'm getting the current template with an sql query. Then i'm doing this:

 

var $template_dir	=  "templates/$template";

 

I get the error: syntax error, unexpected '"'

 

I've read and read but i still don't understand classes <_<

 

Pastebin: http://pastebin.com/m6060ab95

Have you tried concating the string instead?

 

try...

var $template_dir = "templates/" . $template;

$template_dir should just be the directory of your templates, so in this case;

 

var $template_dir = 'templates/';

  • Author

How is it supposed to know which template to use then?

 

Yes i have tried concating it.

In your PHP script you'll tell Smarty which template you want to use inside the template_dir directory, at the point at which you invoke it. First I'll assume you've instantiated a Smarty object (usually in a Smarty config file included in each page which uses the framework), and configured the variables in the object like this:

$smarty = new Smarty();
$smarty->template_dir = '/path/to/templates/';

Then, for example, invoke the "mytmpl.tpl" template file in a script like this:

$smarty->display('mytmpl.tpl');

Hope that helps!

Create an account or sign in to comment

Account

Navigation

Search

Search

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.