Smarty Error

Having trouble installing serendipity?
Post Reply
spackler
Regular
Posts: 27
Joined: Fri Aug 19, 2005 8:13 pm
Location: Milwaukee
Contact:

Smarty Error

Post by spackler »

When I set up S9Y I use the default template and I modify the setup as follows:

create a config.inc.php file with the following code:

Code: Select all

<?php
$serendipity['smarty']->register_function('header_function', 'header_function');

function header_function($smarty) {
  include("templates/default/header.php");
}

$serendipity['smarty']->register_function('footer_function', 'footer_function');

function footer_function($smarty) {
  include("templates/default/footer.php");
}

?>
I then add {header_function} and {footer_function} to my index.tpl file under templates/default/

In my latest install I'm getting the following error when I add the {header_function} to the index.tpl file:
Fatal error: Smarty error: [in /kunden/homepages/11/d324436123/htdocs/templates/default/index.tpl line 31]: syntax error: unrecognized tag 'header_function' (Smarty_Compiler.class.php, line 599) in /homepages/11/d324436123/htdocs/bundled-libs/Smarty/libs/Smarty.class.php on line 1092

Any idea what's causing this? I've been trying to figure it out for hours!!

Thank you!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty Error

Post by garvinhicking »

Hi!

Hm, you are absolutely sure that the config.inc.php file was properly saved, right?

Two things I would try: 1. move register_function to the bottom of your files, after the functions are declared, and in the header_function() code use a full path to the header.php file, like $_SERVER['DOCUMENT_ROOT'] . '/serendipity/templates/default/header.php.

Also you could do a simple "echo" in your config.inc.php file to make sure that it's executed?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
spackler
Regular
Posts: 27
Joined: Fri Aug 19, 2005 8:13 pm
Location: Milwaukee
Contact:

Re: Smarty Error

Post by spackler »

properly saved - I created and uploaded the file as usual, set permissions to 755, is there anything else I need to check?
1. move register_function to the bottom of your files, after the functions are declared
Also not sure what you mean here, when you say bottom of your files, what does that refer to? The bottom of index.tpl?

I'm also not running the application in a serendipity folder, would that matter? I installed it in the main directory, and it does work if I don't add my mod.

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty Error

Post by garvinhicking »

Hi!

Into which file did you save the config.inc.php file exactly? Are you 100% sure it's the template directory of your currently selected template?

register_function is the place of the code you pasted, config.inc.php.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
spackler
Regular
Posts: 27
Joined: Fri Aug 19, 2005 8:13 pm
Location: Milwaukee
Contact:

Re: Smarty Error

Post by spackler »

Into which file did you save the config.inc.php file exactly? Are you 100% sure it's the template directory of your currently selected template?
Boy do I feel stupid...

I only have one template (default) installed and yes config.inc.php is stored under /templates/default directory and when I went to check the obvious fact that I installed the template I clicked the disk icon and it says, successfully installed. ?? Wha ?? :oops: I swear I already did that and I was making changes to the index.tpl that were showing up so I assumed that it was installed.

Anyway, thanks!
Post Reply