vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   I have a php if conditional, please help how to write it in template (https://vborg.vbsupport.ru/showthread.php?t=284375)

basketmen 06-13-2012 08:48 AM

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.

kh99 06-13-2012 10:39 AM

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.

basketmen 08-28-2012 02:42 AM

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'">

Scanu 08-28-2012 07:22 AM

Quote:

Originally Posted by basketmen (Post 2360594)
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> 


basketmen 08-28-2012 11:47 PM

Quote:

Originally Posted by Scanu (Post 2360632)
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

basketmen 08-30-2012 09:57 AM

Quote:

Originally Posted by basketmen (Post 2360594)
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


All times are GMT. The time now is 03:10 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.01193 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete