Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 08 May 2011, 01:43
EWGF EWGF is offline
 
Join Date: May 2007
Question How to use compile_template function?

I want to parse conditions with a custom databasetable, so according to vb.com I need to use the compile_template() function.


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

Besides including adminfunctions_template.php, I have NO idea how to use this in a .php file. Does anyone here know how to use this function?
Reply With Quote
  #2  
Old 08 May 2011, 01:45
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
I do on vb 4.
Reply With Quote
  #3  
Old 09 May 2011, 13:15
EWGF EWGF is offline
 
Join Date: May 2007
I've looked through some mods here on vb.org. Is it true you can only parse specific specified condition codes and not the template where you want to parse every possible code?
Reply With Quote
  #4  
Old 09 May 2011, 13:30
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
I'm not sure what you're asking. There is a set of php functions that you are allowed to use in an if condtion, if that's what you mean. Are you saying you want to compile a template without that restriction?
Reply With Quote
  #5  
Old 09 May 2011, 14:48
EWGF EWGF is offline
 
Join Date: May 2007
Yes. I have made a simple cms -for outside the forum directory- with some custom tables, but the content in those custom tables can't use conditions and other php functions (the codes show up unparsed in the HTML output). According to vb.com I need to use the compile_template() function for this to work and I'm having trouble to get this function working.

Database content:

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

HTML output getting unparsed:

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

Reply With Quote
  #6  
Old 09 May 2011, 15:11
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
I did this short test by creating a plugin using hook misc_start:


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


and the result is:


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


so it seems like it's working, although I'm not sure how you're supposed to deal with the dots at the beginning and end, I guess when the function is used there are other strings added to the beginning and end.

Anyway, are you using the return value of compile_template()? I don't think it changes the parameter you pass.
Reply With Quote
  #7  
Old 09 May 2011, 22:12
EWGF EWGF is offline
 
Join Date: May 2007
Yes. I also tried echoing and evaling the db->query or the template name.

But seeing your short test, it's not possible to process the custom db as a vBulletin template? If not, I might be able to wrap it up with some custom templates.
Reply With Quote
  #8  
Old 09 May 2011, 22:24
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Sorry, I don't really understand what you are asking.

But in case it helps, I played with it a little more and got this:


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


and the output is


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


but maybe this has nothing to do with your problem.
Reply With Quote
  #9  
Old 09 May 2011, 22:38
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Take a look at this mod. Bob uses compile_template for search and replace.

http://www.vbulletin.org/forum/misc....mcategoryicons
Reply With Quote
  #10  
Old 11 May 2011, 18:57
EWGF EWGF is offline
 
Join Date: May 2007
Thanks, I will look in it
Originally Posted by kh99 View Post
Sorry, I don't really understand what you are asking.

But in case it helps, I played with it a little more and got this:


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


and the output is


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


but maybe this has nothing to do with your problem.
I tested it too, it doesn't work correct with an else statement though


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


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

I'm afraid there's no way in parsing a custom made database table as if it were a vB template
Reply With Quote
  #11  
Old 15 May 2011, 03:32
asdfadrian asdfadrian is offline
 
Join Date: May 2011
I have this issue as well. Maybe my contribution will provide some movement and a closer find to a fix.

I am using a custom template that is a cnp (which I plan to edit) of the FORUMDISPLAY template for specific forumids.

I discovered that the statement below does not work:

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

However, if you replace the forumslist with quicksearch it will like below:

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

So some variables are not included in the template, so you have to define them somehow.

Further information and details can be found at this thread.

Last edited by asdfadrian; 15 May 2011 at 03:42.
Reply With Quote
  #12  
Old 16 May 2011, 21:39
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
I know for me in VB3 templates I can never use the single quotes... try:

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

__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
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 06:42.

Layout Options | Width: Wide Color: