After wrestling with the code and getting my head wrapped around another person's project/code. I was able to get a feed going. But it was the text only version at first. Another problem was that the whole gallery was loading into the RSS feed, which technically doesn't make sense. I didn't like how I was forced to remove the login section off the index page at first, but that was the only way I could wrap my head around what was going on.
The original creator, Sharon, used an array to get all the pictures to show up, which I was able to echo into the feed. I couldn't get only 50 to show up. But then I started to study the function that she wrote and there was something called, array_slice. From the PHP.net site on array_slice, I was able to gather that you can pull out a particular section of an array based on where in the arrary to start (offset) and how many (length). I had the offset start at zero but the problem was the pubdate started from unix time (Jan. 1969)!! So I changed it to one. If you have a key index array, you would have to worry about this problem but since the gallery used an associative array, I had to offset by 1. As for length, I set it to 50 to get 50 entries in the feed. How awesome is that! And this took me how long....better not count the days.
After get the array to work (like finally, horray), I tried to figure out how to get pictures to show up. I tried to use the htmlentities in php echo, but it returned absolutely nothing!! At first I saw Joel's code but I couldn't figure out how to re-fit for the page because he used a key index array. Then I looked into Sharon's work and saw she used a string to print the html img tag along with the variable. Like this:
<_?_php imgstring_="_htmlentities(" _img_src="'http://someURL/{_$image['filename']_}'">");_?_><_?_=>
**Please note that I am using underscores to have the code display, otherwise the server will treat it like real code and we get to see nothing.
BTW, I also figured out how to get the RSS feed to work with the login option on the index page, so double horrah.
Thursday, November 20, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment