Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 07 Jul 2012, 03:30
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Real name: Austin
Running Quick PHP in a Template Via Plugin

I'm trying to just make a very simple and quick variable that I'd like to place into a template. I made a plugin using global_start and just put something along the lines of:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then I try to pull that variable in a template, but it doesn't work.

Am I missing something?
Reply With Quote
  #2  
Old 07 Jul 2012, 04:06
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
You're correct you simply put $variable wherever you want to see the number 1
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #3  
Old 07 Jul 2012, 04:41
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Real name: Austin
It doesn't work, unfortunately.

My plugin literally is under global_start:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Within my template is
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Doesn't work.
Reply With Quote
  #4  
Old 07 Jul 2012, 05:35
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
Nope, in your template just put $variable
or you can use it like this <td>$variable2345</td> which will give you 12345
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #5  
Old 07 Jul 2012, 14:18
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Real name: Austin
Right. But it doesn't work. I put $variable and it shows nothing. I pull up the source and it's like it's not even there.
Reply With Quote
  #6  
Old 07 Jul 2012, 14:22
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Where are you using your template? Some templates are used inside a function, and then you can't use global variables directly. You could try using $GLOBALS['variable'].
Reply With Quote
  #7  
Old 07 Jul 2012, 14:36
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Real name: Austin
I guess that makes sense.

I'm modifying 4 templates:

forumhome_forumbit_level1_nopost
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
forumhome_forumbit_level2_post
Reply With Quote
  #8  
Old 07 Jul 2012, 14:41
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Real name: Simon
I guess it would be best if you showed us EXACTLY what you are using, with what hook and where you are trying to use it in those templates.
__________________
Kind regards,
Simon Microsoft Office Help
My Mods: Find my modifications here
Please do not pm me for support unless i have invited you to!
Reply With Quote
  #9  
Old 07 Jul 2012, 14:44
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by evenmonkeys View Post
I guess that makes sense.

I'm modifying 4 templates:

forumhome_forumbit_level1_nopost
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
forumhome_forumbit_level2_post

I think that's your problem - those are used in the function construct_forum_bit() (in includes/functions_forumlist.php), so your global variable isn't in scope.
Reply With Quote
  #10  
Old 08 Jul 2012, 20:42
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Real name: Austin
Awesome. Thank you. I see what I'm not doing correctly. I just had to change the hook location. Appreciate the help, kh99.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 10:30.

Layout Options | Width: Wide Color: