Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 08-28-2011, 09:27 AM   #1
gleem
Confirmed User
 
gleem's Avatar
 
Industry Role:
Join Date: Jun 2001
Location: Sunny Land
Posts: 5,593
SMARTY HELP: how to print a number for -foreach-

If am doing a "foreach" and this is the foreach statement... how do I get smarty to out put a count number for each "foreach" it outputs?

here's the smarty foreach statement I'm using in my CARMA template:

PHP Code:
{foreach from=$carma_comments item=comments
Basically just want to show the comment number on a particular gallery and since it stores the comment ID as overall sitewide comment there's no comment number for that gallery in the array.
__________________




Contact me: \\// E: webmaster /at/ unprofessional.com
gleem is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-28-2011, 09:39 AM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,946
smarty has a counter function

http://www.smarty.net/docsv2/en/lang...nction.counter
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-28-2011, 09:52 AM   #3
gleem
Confirmed User
 
gleem's Avatar
 
Industry Role:
Join Date: Jun 2001
Location: Sunny Land
Posts: 5,593
Quote:
Originally Posted by fris View Post
ahh, I knew I was missing something, thanx
__________________




Contact me: \\// E: webmaster /at/ unprofessional.com
gleem is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-28-2011, 10:54 AM   #4
JayS
Confirmed User
 
JayS's Avatar
 
Join Date: Oct 2007
Posts: 138
Quote:
Originally Posted by gleem View Post
ahh, I knew I was missing something, thanx
If you just need the number of the iteration you can use something like this:

PHP Code:
{foreach from=$carma_comments item=comments name=bla}  
    
Comment #{$smarty.foreach.bla.iteration}
{/foreach} 
More info here: http://www.smarty.net/docsv2/en/lang...nction.foreach
JayS is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-28-2011, 01:54 PM   #5
Diomed
Converting like it's 1999
 
Diomed's Avatar
 
Industry Role:
Join Date: Jan 2009
Location: The South
Posts: 6,165
Thank god I'm on the advertising side of things.
__________________
10 years of experience in:

CHAT SALES - PAID TRAFFIC - CONVERSION - CREATIVES - CONSULTATION
Diomed is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-28-2011, 02:19 PM   #6
Fucksakes
Shit... Fuck! What the Hell?
 
Fucksakes's Avatar
 
Industry Role:
Join Date: Dec 2003
Posts: 7,567
Quote:
Originally Posted by Diomed View Post
Thank god I'm on the advertising side of things.
always good to know more ;)
Fucksakes is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-28-2011, 08:29 PM   #7
gleem
Confirmed User
 
gleem's Avatar
 
Industry Role:
Join Date: Jun 2001
Location: Sunny Land
Posts: 5,593
Quote:
Originally Posted by Fucksakes View Post
always good to know more ;)
No doubt, I do design, marketing, affiliate repping, write articles, html css & push php & smarty code around... just enough to get by at least.

Some people do 1 thing great, I do many things good, and a few things above or below average.
__________________




Contact me: \\// E: webmaster /at/ unprofessional.com
gleem is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.