Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 02 May 2020, 19:38
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Question Foreach in plugin

So I am trying to use a foreach in my plugin and call it in my template with a variable, since my foreach is open it's breaking my product. How can I go about calling a foreach and include it in my template?


My before product, raw php:

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




so I have my plugin like this (and yes the other variables are defined, this is just where the is)

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

and the template like this

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

and it breaks, the variable
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

works on its own, but nothing works when i add the portion above it.
__________________
I have re-launched vBTeam! No longer will it be a warez site, but an alternative to here. Come Join Us Today!
I like to work with vB3, but if you have a custom request anything vB hire me here!
If you need support for any of my products, GO HERE
Reply With Quote
  #2  
Old 02 May 2020, 20:06
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
I am no expert but …
1 - there is an extra semicolon at line 2 of your php code
2 - PHP variables, I think underscore should be used not dashes
Reply With Quote
  #3  
Old 02 May 2020, 21:33
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Also PHP doesn't have any type of macro support like that (unlike C++ macro definitions using #define). You can't assign portions of a function to a variable and then execute the function as usual by calling the PHP variables in order.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #4  
Old 03 May 2020, 00:01
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Real name: Milk Pink
Template:

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

Plugin:
hook : parse_templates

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

Note: This is just a randon guess!
Reply With Quote
  #5  
Old 03 May 2020, 00:32
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Real name: Ryan
Originally Posted by PinkMilk View Post
Template:

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

Plugin:
hook : parse_templates

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

Note: This is just a randon guess!
thanks pink, i did something similar, been reading through alot of articles on here to find anything similar. I ended up doing it all in the plugin since im calling multiple varibles throughout the html code as well.

so my end results ended up being along these lines:

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

then just used the $cantTellYa variable in the template, this seems to work well, there are multiple spans and variables in the code, i just shortened everything to display it here.
__________________
I have re-launched vBTeam! No longer will it be a warez site, but an alternative to here. Come Join Us Today!
I like to work with vB3, but if you have a custom request anything vB hire me here!
If you need support for any of my products, GO HERE
Reply With Quote
Reply


Tags
foreach, php, plugin, template


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 15:57.

Layout Options | Width: Wide Color: