Hi,
I don't know if my title for this topic/question is the best. I don't really know how to explain it very well, but I will give it a go.
Basically I want to create a photo gallery. I could do it the normal way with a clonable template, and insert images into an editable region. I just want to try and do it a bit simpler.
I've found a short little php snippet that will display all images from a folder on my server. Here is the php code I've found:
This works if I put some images inside a folder called greenhouse. What I want to be able to do tho is to use a code similar to this with some couch commands:
You might see the Couch field called photography_folder. I have created a clonable template where I have a field where I want to input the name of the folder I've uploaded some photos to. The problem is that the php code doesn't work when I use the couch command. By using this php snippet with couch I could display all images in a folder very easily without having to manually insert them into an editable region.
Any idea how I could fix this?
I don't know if my title for this topic/question is the best. I don't really know how to explain it very well, but I will give it a go.
Basically I want to create a photo gallery. I could do it the normal way with a clonable template, and insert images into an editable region. I just want to try and do it a bit simpler.
I've found a short little php snippet that will display all images from a folder on my server. Here is the php code I've found:
- Code: Select all
<?php
$files = glob("photographs/greenhouse/*.*");
for ($i=0; $i<count($files); $i++)
{
$num = $files[$i];
echo '<img src="http://agoberg.tv/'.$num.'" alt="random image">'." ";
}
?>
This works if I put some images inside a folder called greenhouse. What I want to be able to do tho is to use a code similar to this with some couch commands:
- Code: Select all
<?php
$files = glob("photographs/<cms:show photography_folder />/*.*");
for ($i=0; $i<count($files); $i++)
{
$num = $files[$i];
echo '<img src="http://agoberg.tv/'.$num.'" alt="random image">'." ";
}
?>
You might see the Couch field called photography_folder. I have created a clonable template where I have a field where I want to input the name of the folder I've uploaded some photos to. The problem is that the php code doesn't work when I use the couch command. By using this php snippet with couch I could display all images in a folder very easily without having to manually insert them into an editable region.
Any idea how I could fix this?