vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   do not display certain attachments. (https://vborg.vbsupport.ru/showthread.php?t=115546)

Bernd 05-14-2006 10:34 AM

do not display certain attachments.
 
I'm trying to write a simple if statement to disallow the forum from displaying image attachments with the name "thumb.jpg".

$attachment[filename] returns the name of the image, so that's working just fine. However, the if statement below displays the text thumbnail at all times. What am I doing wrong here? (the code below is stated in one of the templates). I've just started looking into php ;)

PHP Code:

<if $attachment[filename]="thumb.jpg">
thumbnail
</if> 


Alan @ CIT 05-14-2006 10:39 AM

Try:

PHP Code:

<if $attachment[filename] == "thumb.jpg">
thunbnail
</if> 

For comparison, you need to use 2 equals signs (==). 1 will just set $attachment[filename] to "thumb.jpg" instead of comparing it.

Thanks,
ALan.

Bernd 05-14-2006 10:53 AM

I've tried that and it still returns thumbnail no matter what.

Are statements somehow limited in templates? I haven't seen any if statements in other template files except for "if condition etc".

Alan @ CIT 05-14-2006 11:00 AM

What template are you editing, and where are you putting the edit?

Bernd 05-14-2006 11:03 AM

It's a template from a custom hack, but it contains the following

PHP Code:


$attachment
[filename

<
a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$attachment[dateline]"<if condition="$show['newwindow']"target="_blank"</if>>
<
img class="thumbnail" src="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;stc=1&amp;thumb=0&amp;d=$attachment[thumbnail_dateline]border="0" align="center"></a>
&
nbsp;<if condition="$show['br']"><br /><br /></if> 

I added $attachment[filename] in the above code to see if it pulls the file names of the attached files, and it does...so the if statement you provided should work? Don't no why it doesn't.

Alan @ CIT 05-14-2006 11:03 AM

ooops, sorry - type on my part. It should look something like:

PHP Code:

<if condition="$attachment[filename]==thumb.jpg"
thunbnail 
</if> 

Take a look at the template conditionals section here http://www.vbulletin.com/docs/html/ if that doesn't work.

Bernd 05-14-2006 11:13 AM

Thanks for your help.

PHP Code:

<if condition="$attachment[filename] == "thumb.jpg""

turned out to be the correct if statement :)


All times are GMT. The time now is 04:50 PM.

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.01022 seconds
  • Memory Usage 1,732KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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