Template / hook help?
#6
(2015-06-15, 11:52 AM)marcus123 Wrote: You need to hook to postbit and then in the function you have to mention $post and use $post['whatever'] in the template!

// PostBit hook
$plugins->add_hook("postbit", "hello_world");

// _postbit
function hello_world(&$post)
{
    global $templates;



eval("\$post['whatever'] = \"".$templates->get("your_template")."\";")
       
    }

Thank you marcus Smile

This seems to be getting closer! i mean when i do a print_r($post['logo']); exit(); after the eval there seems to be the logo in there, but on the template where i'm trying to use it {$post['logo']} returns nothing.

Is there something i am missing?
function plugin_avatar(&$post)
{

    eval("\$post['logo'] = \"".$templates->get("postbit_avatar")."\";"); 
    $post['logo'] = $avatar['logo'];
}
Wait i think i am mistaken to how i should be using this all T_T
damn i'm new to this haha.  Blush


Right i was mistaken to what i was trying to do!
eval("\$post['logo'] = \"".$templates->get("postbit_avatar")."\";"); <---- this would make $post['logo'] equal the template.

but what i want to do is make it so the template can use {$post['logo']} as an image source.
but $post['logo'] = $avatar['logo']; does not seem to output anything before the template is made.
But when the function is called $post['logo'] is equal to something.

So what i need to work is $post['logo'] to be equal to something as the template is being called.

Aha! i have fixed the issue :Smile (finally)


$post['logo'] = $avatar['logo'];
eval("\$post['useravatar'] = \"".$templates->get("postbit_avatar")."\";");
The issue was i needed to re-call the useravatar template, so that it could use the $post['logo'] after it was set!

I think explaining it out on the forum helped to solve my issue aha.
Thanks guys.
Reply


Messages In This Thread
Template / hook help? - by Soyabean - 2015-06-14, 09:16 PM
RE: Template / hook help? - by Omar G. - 2015-06-14, 10:06 PM
RE: Template / hook help? - by Soyabean - 2015-06-14, 10:23 PM
RE: Template / hook help? - by Omar G. - 2015-06-15, 06:33 AM
RE: Template / hook help? - by marcus123 - 2015-06-15, 11:52 AM
RE: Template / hook help? - by Soyabean - 2015-06-15, 12:56 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)