Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Is this possible {$tms_categories|@count + 1}?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
SGBoise
Smarty Rookie


Joined: 28 Mar 2008
Posts: 27
Location: GamePacks.org

PostPosted: Mon Nov 10, 2008 6:58 am    Post subject: Is this possible {$tms_categories|@count + 1}? Reply with quote

Hello,

I want to get the count of the array but add 1 to it. I don't want to determine the value in php if I don't have to.

Code:
<ul id="s{$tms_categories|@count + 1}">


Is this possible?

Thanks.
_________________
GamePacks.org - Products for the Arcade/Media Community
Video Script - The ultimate media site script
AutoVideoScript.com - Run your own youtube sharing site
Back to top
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Mon Nov 10, 2008 7:25 am    Post subject: Reply with quote

Try
Code:
{1+$tms_categories|@count}

If you can't get it to work take a look at the {math} function.
_________________
Darn computers always do what I tell them to instead of what I want them to do.
Back to top
View user's profile Send private message
SGBoise
Smarty Rookie


Joined: 28 Mar 2008
Posts: 27
Location: GamePacks.org

PostPosted: Mon Nov 10, 2008 8:22 am    Post subject: Reply with quote

Thanks Celeb.

That didn't work. The documentation said it was pretty expensive to run {math} function. I'll just do it in php and assign it.

Thanks again.
_________________
GamePacks.org - Products for the Arcade/Media Community
Video Script - The ultimate media site script
AutoVideoScript.com - Run your own youtube sharing site
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 541

PostPosted: Wed Nov 12, 2008 1:51 pm    Post subject: Reply with quote

Celeb wrote:
Try
Code:
{1+$tms_categories|@count}

If you can't get it to work take a look at the {math} function.


i could be wrong, but i don't think you need the @ sign, since you're not dealing with arrays.
Back to top
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Wed Nov 12, 2008 5:01 pm    Post subject: Reply with quote

How is he not dealing with arrays? In his first post he said he wanted to count the elements of an array.
_________________
Darn computers always do what I tell them to instead of what I want them to do.
Back to top
View user's profile Send private message
SGBoise
Smarty Rookie


Joined: 28 Mar 2008
Posts: 27
Location: GamePacks.org

PostPosted: Thu Nov 13, 2008 8:27 pm    Post subject: Reply with quote

$tms_categories is an array but I did get it to work php and just assigned it.

Thanks.
_________________
GamePacks.org - Products for the Arcade/Media Community
Video Script - The ultimate media site script
AutoVideoScript.com - Run your own youtube sharing site
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP