Liquid Wiki Wrong?

by shopcora - Member - 07:49PM, Jun 29, 2008

I was using this example from the wiki:

{% if user.name == 'tobi' or if user.name == 'marc' %} 
  hi marc or tobi
{% endif %}

After changing it to fit my needs I received an error.

However when modifying it to this (taking out the second “if”) it worked as expected:

{% if user.name == 'tobi' or user.name == 'marc' %} 
  hi marc or tobi
{% endif %}

So is the wiki wrong? I didn’t want to change it myself b/c I have little to no programming/liquid knowledge and wanted to double check.

---

Cora Boutique – trendy and fashionable women’s clothing
www.shopcora.com

Last edited 07:53PM, Jun 29, 2008

tobi

jaded Pixel

10:22PM, Jun 29, 2008

The syntax is correct but Shopify does not export a user variable. This example was just for demonstration purposes.

---

Tobias Lütke
Shopify – Founder, CEO

shopcora

Member

10:41PM, Jun 29, 2008

Hey Tobi,

Maybe I was vague when posting originally….but what I meant was I took that example from the wiki and used that as my basis in doing this…


{% if collection.handle == 'dresses' or if collection.handle == 'under-20' %} 

sample content

{% endif %}

It didn’t work though…I got some sort of liquid operation error. I then took out the second “if” (if collection.handle == ‘under-20’%} ) and the “or” statement worked as expected. See below:


{% if collection.handle == 'dresses' or collection.handle == 'under-20' %} 

sample content

{% endif %}

So that made me think the wiki example was wrong. Who knows maybe I’m just going crazy.

---

Cora Boutique – trendy and fashionable women’s clothing
www.shopcora.com

Christina

Miss Manners

08:14AM, Jun 30, 2008

no you’re right; the wiki is somewhat outdated.

---

operation absurdist feature requests: terminated

(http://en.wikipedia.org/wiki/Absurdism)

Caroline Schnapp

Member

10:05PM, Jul 04, 2008

Oh great!

Thank you, Kaushal. I was wondering what I was doing wrong. I put an extra ‘if’ there: http://forums.shopify.com/categories/2/posts/20554#comment-20558. I will go correct my Liquid code.

Please correct the Wiki, Tobi. Or is there a way we can edit the Wiki ourselves? :-)

---

Caroline from http://11heavens.com

tobi

jaded Pixel

10:09PM, Jul 04, 2008

Wiki’s are all about user editing :-)

You just have to signup for an account. We had to disable anonymous editing because of all the spam…

---

Tobias Lütke
Shopify – Founder, CEO

Caroline Schnapp

Member

10:10PM, Jul 04, 2008

Kaushal,

What third-party solution are you using for comments on your blog? It does not look this other solution that’s endorsed by Shopify: http://www.haloscan.com/features.php

---

Caroline from http://11heavens.com

Caroline Schnapp

Member

10:10PM, Jul 04, 2008

Let me do the honor then, my dear Tobi. :-)

---

Caroline from http://11heavens.com

Caroline Schnapp

Member

10:12PM, Jul 04, 2008

this other solution that’s endorsed by Shopify

Endorsed is a strong word. Maybe recommended, nudged toward.

---

Caroline from http://11heavens.com

Caroline Schnapp

Member

10:16PM, Jul 04, 2008

You just have to signup for an account. We had to disable anonymous editing because of all the spam…

I signed up and corrected the errors. :-)

---

Caroline from http://11heavens.com

tobi

jaded Pixel

10:29PM, Jul 04, 2008

thank you very much :-)

---

Tobias Lütke
Shopify – Founder, CEO

shopcora

Member

01:15AM, Jul 05, 2008

Hey Caroline, the blog on our site is actually a wordpress blog hosted on another server with a different domain name (coraboutique.com/blog)

---

Cora Boutique – trendy and fashionable women’s clothing
www.shopcora.com

Caroline Schnapp

Member

02:53AM, Jul 05, 2008

Thank you, Kaushal, for getting back to me on this.

---

Caroline from http://11heavens.com

You must login to post a comment!

Don't have an account yet? Sign up for one.