Hi, I've got a bit of a problem and I can't see how I should fix this.
I've got two tables in my database, pages and pictures.
In the pages table I store the content of my webpages, and in pictures I store the filename of my pictures and the page_id.
Now through some simple CMS page users can alter the webpages. They can choose several templates for a site, and type some text, but nothing more. In the templates, I've set some places for images to appear (I've just coded: <img src="#1" />).
This all works fine, my problem appears when I want to show the specific pages. I just get the page content from the database, but then I need to replace the #1, #2 etc. by the filename from my picture.
I figured I could do this with a for each loop or something, but I just can't get it to work (this is my first encounter with a for loop, so I don't really know how to set it up).
This is what I got so far:
I get the pictures from my database with a datareader, and then I tried to put the pictures in an array:
Do While reader.Read()
pictureArray.Add(reader("pic_file_name").ToString)
Loop
But then I have no idea how to replace the #1, #2 etc. with the contents of the arraylist.
Does anyone have an idea how to do this, I'm not asking for the exact code, just a push in the right direction would be great.
Thanks
I've got two tables in my database, pages and pictures.
In the pages table I store the content of my webpages, and in pictures I store the filename of my pictures and the page_id.
Now through some simple CMS page users can alter the webpages. They can choose several templates for a site, and type some text, but nothing more. In the templates, I've set some places for images to appear (I've just coded: <img src="#1" />).
This all works fine, my problem appears when I want to show the specific pages. I just get the page content from the database, but then I need to replace the #1, #2 etc. by the filename from my picture.
I figured I could do this with a for each loop or something, but I just can't get it to work (this is my first encounter with a for loop, so I don't really know how to set it up).
This is what I got so far:
I get the pictures from my database with a datareader, and then I tried to put the pictures in an array:
Do While reader.Read()
pictureArray.Add(reader("pic_file_name").ToString)
Loop
But then I have no idea how to replace the #1, #2 etc. with the contents of the arraylist.
Does anyone have an idea how to do this, I'm not asking for the exact code, just a push in the right direction would be great.
Thanks