Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 28 Mar 2014, 07:37
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Real name: Milk Pink
Should variables contain apostrophes in templates?

Should variables contain apostrophes in templates?

What I mean by this is should they look like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

or

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

both seem to work and I have seen many people use with and without in examples, as well as in the templates themselves, but I would like to know if one is safer then the other, whether it is simply user preference or something else entirely.

Note to mods:
I have accidentally posted this in the wrong forum, it should be in the vB3 General Discussions or vB3 Programming Discussions.

Last edited by PinkMilk; 28 Mar 2014 at 07:47.
Reply With Quote
  #2  
Old 28 Mar 2014, 08:32
AusPhotography's Avatar
AusPhotography AusPhotography is offline
 
Join Date: Nov 2007
Real name: Rick-owner, Kym-admin
Zend uses quotes... http://framework.zend.com/manual/1.1...ing-style.html

PHP doco says use quotes... http://www.php.net/manual/en/language.types.array.php
Array do's and don'ts
Why is $foo[bar] wrong?

Always use quotes around a string literal array index. For example, $foo['bar'] is correct, while $foo[bar] is not. But why? It is common to encounter this kind of syntax in old scripts:
Read more in link above
__________________
www.AusPhotography.net.au a.k.a. AP is a photography forum where members share their photography, photo editing skills and techniques. We run regular photographic competitions; Rick (site owner) and Kym (site tech) using this account
*** Home of the AP fully comprehensive vb4 photographic competition management solution ***
Reply With Quote
  #3  
Old 29 Mar 2014, 21:59
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Real name: Milk Pink
So basically treat as if they where php.
Reply With Quote
  #4  
Old 29 Mar 2014, 22:17
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by PinkMilk View Post
So basically treat as if they where php.
Right, the stuff in a condition goes pretty much directly into an if statement (although it's checked for function calls that aren't allowed). It's the same in vb4, even though the tag syntax is a little different.

And although you didn't ask about it, variables used in a template (in vb3) go in to a double quoted string, so those rules apply there.

Last edited by kh99; 29 Mar 2014 at 22:54. Reason: clarified
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 22:25.

Layout Options | Width: Wide Color: