Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

8 posts by 2 authors in: Forums > CMS Builder
Last Post: March 8, 2011   (RSS)

By Keltam2 - March 7, 2011

Hi there!
I am working with a horizontal glider widget that will create a new panel for the last 8 news records posted. I was going to use the 'num' field so that each panel had a dynamically generated ID, but it looks like the panels have to be in numerical order, starting with one.

I added in a drop-down menu as a temporary fix with 1 through 8 as values, but that requires the last 8 articles to be updated every time a new one is posted. I thought there must be something that could automatically generate those values? I just wasn't sure where to start!
thanks!
Kelly

Re: [Keltam2] Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

By Jason - March 7, 2011

Hi,

You can have a counter variable that starts at one and is increment for each record. If you could attach the .php file you're currently working with, I can try to give you an example.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

By Keltam2 - March 8, 2011

Hi Jason - Thanks! Here is the file - the ForEach statement starts at Line 498 through 578. The record 'home_page_features' is where the 1 through 8 value should go. Let me know if you need any other info!
Kelly

Re: [Keltam2] Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

By Keltam2 - March 8, 2011

Here's the file! =)
Attachments:

homepg.php 46K

Re: [Keltam2] Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

By Jason - March 8, 2011

Hi,

I took a look at your code and I'm having a little trouble finding where you're "Glider" code currently is. Could you show me a code snippet of what you're doing currently?

Also, I found this code several times on your page:

require_once "/home/kwings/public_html/cmsAdmin/lib/viewer_functions.php";

This code only needs to appear once on your page and should always be put at the very top.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

By Keltam2 - March 8, 2011

Hi Jason -
Here's the glider code separated out:
http://www.kwings.com/glider.php

thanks!
Kelly
Attachments:

glider.php 15K

Re: [Jason] Create numbering (1, 2, 3 . . 8) dynamically for last 8 records posted

By Keltam2 - March 8, 2011

Perfect! Exactly what I was looking for - thank you so much for your help! =)