Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2012, 08:48 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default I have a php if conditional, please help how to write it in template

this is if conditional for if the url is xxx, in php

Quote:
if ($vbulletin->url == 'http://domain.com/forum/somepage.html')
{
}

i want to use it in template, please help what is looks like?






i already tried this
Quote:
<if condition="$vbulletin->url == http://domain.com/forum/somepage.html">
</if>
but got error like this and cant save the template

Quote:
The following error occurred when attempting to evaluate this template:

Parse error: syntax error, unexpected ':' in /home/username/public_html/includes/adminfunctions_template.php(3605) : eval()'d code on line 91

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
Reply With Quote
  #2  
Old 06-13-2012, 10:39 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You removed the single quotes when you put it in the template condition, but you need them. Try taking the php condition that's between the parentheses and just copy it to between the quotes in the template.
Reply With Quote
  #3  
Old 08-28-2012, 02:42 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

arghh i am still cant make it, already tried add the single quote, so like this

Quote:
<if condition="$vbulletin->url == 'http://domain.com/forum/somepage.html'">
</if>


can anyone tried it please, or know the working this conditional



i already tried this too (from this thread), but looks like still not working too
<if condition="$_SERVER['REQUEST_URI'] == '/forum/somepage.html'">
Reply With Quote
  #4  
Old 08-28-2012, 07:22 AM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by basketmen View Post
arghh i am still cant make it, already tried add the single quote, so like this





can anyone tried it please, or know the working this conditional



i already tried this too (from this thread), but looks like still not working too
<if condition="$_SERVER['REQUEST_URI'] == '/forum/somepage.html'">
Strange.. Try
PHP Code:
<if condition="$_SERVER['SCRIPT_URI'] == 'http://www.domain.com/forum/somepage.html'"
Or this
PHP Code:
<if condition="$vb->url == 'http://domain.com/forum/somepage.html'">
</if> 
Reply With Quote
  #5  
Old 08-28-2012, 11:47 PM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Scanu View Post
Strange.. Try
PHP Code:
<if condition="$_SERVER['SCRIPT_URI'] == 'http://www.domain.com/forum/somepage.html'"
Or this
PHP Code:
<if condition="$vb->url == 'http://domain.com/forum/somepage.html'">
</if> 
thank you for answering, but that code still not working too

can anyone try it in your forum please
Reply With Quote
  #6  
Old 08-30-2012, 09:57 AM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by basketmen View Post
i already tried this too (from this thread), but looks like still not working too
<if condition="$_SERVER['REQUEST_URI'] == '/forum/somepage.html'">
ah this one at least works,

and the url used is the non rewrited url, so the original url, if the url are rewrited by vbseo or another mod

Scanu methode above maybe works too, and using the original url

only the first methode that not working, even already using original url, wonder why, but its ok already have the working code
Quote:
<if condition="$vbulletin->url == 'http://domain.com/forum/somepage.html'">
</if>


Thank you and GBU for Scanu and kh99
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 03:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05349 seconds
  • Memory Usage 2,223KB
  • 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
  • (4)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete