Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 05 May 2011, 19:24
TrigZu TrigZu is offline
 
Join Date: Jul 2010
Is passing raw variables from PHP to be parsed by a template possible?

Is passing raw variables from PHP to be parsed by a template possible?

I have this in my PHP page.

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

And this in my template

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

However the vB template conditionals aren't being parsed.

It's just going straight to the web page.

Last edited by TrigZu; 05 May 2011 at 19:50.
Reply With Quote
  #2  
Old 05 May 2011, 23:09
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Parse the conditions in your php and then just pass the result.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #3  
Old 05 May 2011, 23:13
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
Why would you want to do that? template conditionals is just a cheap method because php isn't available there. Everything you can build with template vars, you can do even better with php.


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

Reply With Quote
  #4  
Old 05 May 2011, 23:31
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Originally Posted by Disasterpiece View Post
Why would you want to do that? template conditionals is just a cheap method because php isn't available there. Everything you can build with template vars, you can do even better with php.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Ahh, so you don't like to use brackets either, huh?


Originally Posted by TrigZu View Post
Is passing raw variables from PHP to be parsed by a template possible?

I have this in my PHP page.

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

And this in my template

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

However the vB template conditionals aren't being parsed.

It's just going straight to the web page.

You could always make a template and just pass that in php with a goof ol' str_replace.

Last edited by Boofo; 05 May 2011 at 23:33. Reason: Auto-Merged DoublePost
Reply With Quote
  #5  
Old 06 May 2011, 00:09
TrigZu TrigZu is offline
 
Join Date: Jul 2010
Originally Posted by Disasterpiece View Post
Why would you want to do that? template conditionals is just a cheap method because php isn't available there. Everything you can build with template vars, you can do even better with php.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Yeah, I know. It's just that I already wrote the whole thing in the template and I wanted to put it in the PHP page instead (I didn't plan ahead), but I'm too lazy to go back and change all of the conditionals to PHP statements. I could use some RegEx to do it "quickly", but I'm sure there's some function built into vB to take care of this, so I guess I'll just look for it. =]

Thanks guys.

Last edited by TrigZu; 06 May 2011 at 02:13.
Reply With Quote
  #6  
Old 06 May 2011, 00:51
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
You first post would never work as vb 4 doesn't recognize the if conditions when you are trying to replace them. There are ways around it but you are not going to find it in the vb documentation, sorry to say.
Reply With Quote
  #7  
Old 07 May 2011, 02:12
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
well, you could try to find the template functions which do the preprocessing, work with output buffers your way around and ... well that's not only a pain but I'd have to put you in jail if you did that, so I highly recommend to learn from your mistakes and re-program it to php.

Ahh, so you don't like to use brackets either, huh?
For 1-2 liners, brackets are useless and blow up the code unnecessarily.

Also, yeah they're uncool.
Reply With Quote
  #8  
Old 07 May 2011, 02:34
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Originally Posted by Disasterpiece View Post
For 1-2 liners, brackets are useless and blow up the code unnecessarily.

Also, yeah they're uncool.
I'm a bracket man, myself. If it is one line, then yes, no brackets are necessary. But if there is an else statement, or more than one line, I always use brackets. The code is a lot easier to read and follow that way. Try putting me in jail for that.
Reply With Quote
  #9  
Old 08 Aug 2011, 20:45
abdicar abdicar is offline
 
Join Date: Oct 2006
So, there is no way to pass a raw variable to a coditional?
Reply With Quote
  #10  
Old 08 Aug 2011, 20:54
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007

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

First if you don't create an instance of the template first, second if you already have an instance
like:

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

Inside the template they exist as $foo so you can write:

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

Reply With Quote
  #11  
Old 09 Aug 2011, 00:36
abdicar abdicar is offline
 
Join Date: Oct 2006
Originally Posted by Disasterpiece View Post
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

First if you don't create an instance of the template first, second if you already have an instance
like:

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

Inside the template they exist as $foo so you can write:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Hi, thank you for answer me.

Actually, I added the $variable to header instance, and i'm available to print $foo in the template, but it don't work in the condition.

Did you try your code? If so, i'll recheck my code, but this is pretty simple...

Thank you!
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 22:39.

Layout Options | Width: Wide Color: