Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 12-31-2002, 03:07 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, can be used easily, but you have to take care when using strings in conditions

there are no securitychecks in, so parse errors can occur very easy

maybe i'm telling you tommorro, i'll go now
Reply With Quote
  #12  
Old 12-31-2002, 03:19 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Heh...

I think I know how, but I'll wait till Master Xenon tells us

Satan
Reply With Quote
  #13  
Old 01-01-2003, 06:47 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, well here it is, as i said, it's not a released hack, no support is given

open admin functions.php
in function gettemplate find this:
PHP Code:
  if ($escape==1) {
    
$template=addslashes($template);
    
$template=str_replace("\\'","'",$template);
  } 
below just add:
PHP Code:
  // conditionals
  
$template=str_replace("<if>","\".iif(",$template);
  
$template=str_replace("<then>",",\"",$template);
  
$template=str_replace("<else>","\",\"",$template);
  
$template=str_replace("</if>","\").\"",$template); 
then in templates you have to use <if><then><else></if> constructions:

Example:
Code:
Hello <if>$bbuserinfo[userid]>0<then>$bbuserinfo[username]<else>Guest, please register</if>
as said, be carefule, it can easily produce parseerrors if you use wrong conditions
It just fits my needs, not any checks
Reply With Quote
  #14  
Old 01-01-2003, 07:06 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
said by hellsatan
Yes you can put PHP in a special template, called the phpinclude template
well, how do you know that is what he wants.. maybe he wants to put something like this in a template:

Code:
if ($bbuserinfo['userid']!=0) {
   echo "member";
} else {
    echo "guest";
}
which will not work.. or am i missing something here? sure you can use the phpinclude template.... but we don't know if that is what he wants to do.. my guess is he wants to put full php code in the templates
Reply With Quote
  #15  
Old 01-01-2003, 07:10 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@sebastian: look my post 8 posts above of yours, there's described how he can use full php-code in the templates also (but not HTML anymore )

The conditional thing i just posted, because boofo wnated it
Reply With Quote
  #16  
Old 01-01-2003, 07:12 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

now we're talking, i didn't see that
Reply With Quote
  #17  
Old 01-01-2003, 08:16 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Xenon, that conditional code looks interesting. Right now, I am using Logicians hack for this (which I thank you for pointing me in that direction ). There's certain instances that you can't use conditionals (like the ismoderator instance). Will yours allow that?
Reply With Quote
  #18  
Old 01-01-2003, 09:06 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Xenon - Those conditions rock

Is there an <elseif> one?

Satan
Reply With Quote
  #19  
Old 01-01-2003, 10:27 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@boofo: yes, normally you can use the ismoderator() function.
you should be able to use every php function in the conditions by me

@satan: you can build it so by nested if's:
Code:
<if>$a==1<then>Hello<else><if>$a==2<then>Hello 2<else>Hello 3</if></if>
But remembe every single condition needs <if><then><else></if>
you cannot use it without the else
it just uses the iif-function from vb, so you are limited to this limits
Reply With Quote
  #20  
Old 01-02-2003, 09:09 AM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see...

Thanks for sharing

Satan
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 02:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04291 seconds
  • Memory Usage 2,260KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete