justin-white Posted October 26, 2008 Share Posted October 26, 2008 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 More sharing options...
corbin Posted October 26, 2008 Share Posted October 26, 2008 You want us to magically know the problem from 1 line of code? Link to comment https://forums.phpfreaks.com/topic/130141-solved-smarty-template-engine/#findComment-674853 Share on other sites More sharing options...
justin-white Posted October 26, 2008 Author Share Posted October 26, 2008 I've looked further on the internet and found the solution, although I was up until 3AM . 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} Link to comment https://forums.phpfreaks.com/topic/130141-solved-smarty-template-engine/#findComment-674989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.