Could someone help a newbie with some simple code, please

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Andrew Prior
Forum Members
Forum Members
Posts: 247
Joined: Sun Oct 28, 2007 4:14 am
Location: Australia

Could someone help a newbie with some simple code, please

Post by Andrew Prior »

Hi. This code lets me add photos with the form lc0x.jpg to a folder to display random images
{capture assign='num'}{1|rand:17}{/capture}
{* generate a random number between 1 and 3, assign it to 'num Equates to no. of photos in left logo folder *}
{if ( 10 gt $num ) }

{else}

{/if}
I would like to add some details to the images and make them link to an associated page

I know how to use an if else statement to choose global content blocks dependent on the random number. 

However, adding a global content block like the one below for each image seems pretty inefficient!
It strikes me I should be able to make a table of four columns, being Index No. Link. Label. and Image. Then, when $num = Index,
set Link. and Image from that row in the table, and place them in the code thusly:
Can someone point me to a help file that would take me through such a process?
or indicate a better method?

I'd appreciate it.
Andrew
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Re: Could someone help a newbie with some simple code, please

Post by Nullig »

Why not use the Album module?

Nullig
Post Reply

Return to “Developers Discussion”