Jump to content

Archived

This topic is now archived and is closed to further replies.

justin-white

[SOLVED] Smarty Template Engine

Recommended Posts

Hello,

I am having some serious problems with the Smarty Template Engine. It could be a newbie mistake, I am new with PHP. I am creating my own CMS, and I am using Smarty for the templates. I have got the template laid out, and I created a function to display the 5 most recent posts. I used this to tell smarty what to replace {$pagecontent} with:

 

$smarty->assign('pagecontent',main_content());

 

It doesn't put the code in the correct spot in the template. It shows the content at the top of the page. Can somebody help me get it into the correct spot?

 

Thanks much!!!

Share this post


Link to post
Share on other sites

You want us to magically know the problem from 1 line of code?

Share this post


Link to post
Share on other sites

I've looked further on the internet and found the solution, although I was up until 3AM  :o .

 

You have to register the function with smarty.

 

$smarty->register_function('tagname','function_name');

 

Then you can use the function by using this in the template:

 

{tagname}

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.