Jump to content

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}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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