Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved How to make a HOOK run a special place in template?
#1
Not Solved
Greetings..

How can I make a HOOK run a special place at the template.

Like if I want to show something from the hook, can I then just put this somewhere "{call_hook_1}" can then make the hook puts output there?
#2
Not Solved
You can't use a hook directly in a template, you need to have a plugin that uses the hook to generate the content that the template evaluates. what are you trying to do?
Lost interest, sold my sites, will browse here once in a while. It's been fun.
#3
Not Solved
I am going to make a custom page, which should include some PHP for my plugin.
I was trying to make like a HTML table in the template, and then add {nomination_something} which then should come up with some data according to what Nomnination ID the user is looking at.

Nomination ID is something that I also make myself.

Data I would like to put into the template:
{nomination_id}
{nomination_name}
{nomination_username}
... and few more.
#4
Not Solved
And how adding a hook will solve it?

$nomination_id = get_nomination_id(); // some function here
eval('$page = "'$templates->get('some_template')..'";');

Then in your "some_template" template add this {$nomination_id}. Now the thing is that get_nomination_id(); should return the nomination ID (it doesn't have to be a function btw).
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
#5
Not Solved
(2012-08-01, 07:43 AM)Omar G. Wrote: And how adding a hook will solve it?

$nomination_id = get_nomination_id(); // some function here
eval('$page = "'$templates->get('some_template')..'";');

Then in your "some_template" template add this {$nomination_id}. Now the thing is that get_nomination_id(); should return the nomination ID (it doesn't have to be a function btw).

Thanks a lot.

So does this work with the {nomination_id}?

And how would it looks for making more of those, would this work?
function get_nomination_name() {return "Just a Test Name";}
function get_nomination_id() {return 1;}

$nomination_name = get_nomination_name(); // some function here
$nomination_id = get_nomination_id(); // some function here
eval('$page = "'$templates->get('some_template')..'";');
#6
Not Solved
Yes, just use {$nomination_name} and {$nomination_id} in your template.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
#7
Not Solved
Thanks a lot.

Another thing..

Is it somehow possible to have a template like:
<div class="my-id">{$my_id}</div>
<div class="my-content">{$my_content}</div>

And then run it like 10 times? Just with a difference value of $my_id and $my_content?

So like for example if I should make a clone of Memberlist, the template is like this for each member in the database:
<div class="member-username">{$member_username}</div>
<div class="member-usergroup">{$member_usergroup}</div>
Would it then somehow be possible to run this 10 times (if there are like 10 users), and then make the value of $member_username and $member_usergroup difference from each run?

Cause that is what I need to do with my own plugin.
Any ideas how to do this?

NOTE: I hope I make sense Smile
#8
Not Solved
Just run the eval function inside a loop.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;


Forum Jump:


Users browsing this thread: 1 Guest(s)