vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   If ...Else...help please!! (https://vborg.vbsupport.ru/showthread.php?t=119523)

naeemakhtar 06-24-2006 11:05 AM

If ...Else...help please!!
 
Hi there all.

Im new to PHP but having some troube in getting some simple bit of code to work.And I am trying...

I know that the syntax for a PhP if..Else test is basically:

<
if(condition)
dothis....
else
dothat....
>

But inside VBulletin when I go to edit my navbar template I see this:

HTML Code:

<if condition="$bbuserinfo['pmunread']">
<a href="http://www.pakistancricketzone.com/private.php?"><img border="0" src="http://www.pakistancricketzone.com/images/xbox/nonewpm.gif" width="220" height="13"></a>

Thats basically shows a graphic if there is an unread PM.But if there isnt I want it to show a different graphic. So I figured the best thing to do is a if..else statement. No matter what I do it seems to fall over or the else isnt recognised. Can someone tell me why?

HTML Code:

<if condition="$bbuserinfo['pmunread']">
<a href="http://www.pakistancricketzone.com/private.php?"><img border="0" src="http://www.pakistancricketzone.com/images/xbox/nonewpm.gif" width="220" height="13"></a>

                <else>
<a href="http://www.pakistancricketzone.com/private.php?"><img border="0" src="http://www.pakistancricketzone.com/images/xbox/newpm.gif" width="220" height="13"></a>
</if>

As far as i can tell the angle brackets just help to keep selcted bits of code together in a block in php and should be translated into HTML at execution time....still dont know why its not working.Can anyone explain why to me please?:(

Many thanks,
Naeem

anyone???

Code Monkey 06-24-2006 02:15 PM

<else />

Kirk Y 06-24-2006 03:56 PM

You might also want to switch your images -- you've got the No New PMs image being displayed when there are Unread Messages and the New PMs Image being displayed when there aren't any.

naeemakhtar 06-24-2006 10:05 PM

Quote:

Originally Posted by acidburn0520
You might also want to switch your images -- you've got the No New PMs image being displayed when there are Unread Messages and the New PMs Image being displayed when there aren't any.

LOL Thanks Guy's. Yep I noticed I did that too and I was gonna go back to edit it but I realised by the time I noticed on the editing what I had done, it would be spotted!!!:D So well spotted and thanks....

Dont worry it wasnt like that in the actual code as I didnt copy and paste all of it 1st time around. Below is the actual code I put in with <IF><Else/> and its still not working.

Basically if there is a message then show newpm.gif otherwise show nonewpm.gif...at the moment it shows neither or both! For the life of me I really cant see why it shouldnt work....it still 'reads' good to me.:surprised:

HTML Code:

<if condition="$bbuserinfo['pmunread']">
<a href="http://www.....com/private.php?">
<img border="0" src="http://www......com/images/xbox/newpm.gif" width="220" height="13"></a>                                                        <else/>
<a href="http://www.....com/private.php?"><img border="0" src="http://www......com/images/xbox/nonewpm.gif" width="220" height="13"></a>       
</if>

I hope you can spot something in it that I cant...and thanks again for your time and help.

Code Monkey 06-24-2006 10:13 PM

<else /> don't forget the space before the / and it's better if you post your code here in code tags.

naeemakhtar 06-24-2006 10:34 PM

Quote:

Originally Posted by JumpD
<else /> don't forget the space before the / and it's better if you post your code here in code tags.

Yaaaaaaaaaaaaaay!!! Thanks a lot for pointing that out for me!!! It works great now!!!

I always thought that the space before the > didnt matter and that the space was just insignificant! Now i know...many thanks again for your help :)


All times are GMT. The time now is 11:16 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.01025 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_html_printable
  • (2)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