Page 1 of 1

Accessing s9y variables in Smarty

Posted: Sun Sep 18, 2005 3:36 am
by Thomas
Hi,

maybe I'm out of practise and this is just a stupid question but I need to know this.
I try to insert a banner display method into my blog and therefore I need to know how to access s9y's variables within Smarty. I know that usually in a PHP script I can access them with $serendipity['serendipityPath'] or $serendipity['fetchLimit']. According to Smarty's documentation I could use $serendipity.fetchLimit for associative variables. But nothing is displayed.

Another issue is the access for those variables within Smarty plugins. My plan is to write a Smarty function for displaying banners and therefore I need path names, for example. I could use hardcoded paths, but this would be amazing bad programming style. :)

Any hints or tips?

Re: Accessing s9y variables in Smarty

Posted: Mon Sep 19, 2005 4:08 pm
by garvinhicking
Actually, because of performance reasons, not all $serendipity values are assigned to Smarty. See include/functions_smarty.inc.php in the smarty_init() function call.

If you want to assign more or all of Serendipity's values to your template, create a "config.inc.php" file in your template directory:

Code: Select all

<?php
$serendipity['smarty']->assign('s9y', $serendipity);
?>
Best regards,
Garvin