Forum Sitebox Do we have any functions available in Sitebox?

Discussion and help relating to the PlayerIO webpage and Facebook app hosting solution, Sitebox.

Do we have any functions available in Sitebox?

Postby azuanagames » October 5th, 2010, 12:03 pm

I'd like to do something like this:
Code: Select all
{% if indexOf(',', post_ids) > 0 %}
  Thank you, your friends have been invited!
{% else %}
  Thank you, your friend has been invited!
{% end %]


or maybe

Code: Select all
{% if post_ids contains ',' %}
  Thank you, your friends have been invited!
{% else %}
  Thank you, your friend has been invited!
{% end %]
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Do we have any functions available in Sitebox?

Postby Benjaminsen » October 5th, 2010, 12:51 pm

Expose the data as a JS variable and use JS to print the proper text.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Do we have any functions available in Sitebox?

Postby azuanagames » October 5th, 2010, 2:06 pm

Right-o that's what I'll do for now, just would be nice :)
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Do we have any functions available in Sitebox?

Postby Benjaminsen » October 5th, 2010, 2:42 pm

azuanagames wrote:Right-o that's what I'll do for now, just would be nice :)


Clever guy! I will add it to the Nice to have feature list then.

/Chris
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Do we have any functions available in Sitebox?

Postby azuanagames » October 5th, 2010, 3:28 pm

I'm not a JavaScript expert... So... Do you mind looking at this?
Code: Select all
<script>
    var ids = "{{post_ids}}";
    if (ids.IndexOf(",") > 0) {
       document.write("Thank you, your friends have been invited!");
    } else {
       document.write("Thank you, your friend has been invited!");
    }
</script>


Spot anything wrong?
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Do we have any functions available in Sitebox?

Postby Benjaminsen » October 5th, 2010, 4:08 pm

indexOf does not have a capitalized I in JavaScript
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Do we have any functions available in Sitebox?

Postby azuanagames » October 5th, 2010, 4:25 pm

That's sad...

Thank you, wish it had showed up in the console, would not have wasted your time :|
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm


Return to Sitebox



cron