Jump to content

[SOLVED] Smarty Template Engine


justin-white

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!!!

Link to comment
https://forums.phpfreaks.com/topic/130141-solved-smarty-template-engine/
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}

Archived

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

×
×
  • 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.