I am using a master page (rss_master.php) with variables in it to make weekly changes to parts of several other pages. On the rss_master.php page some of the variables are named: $newitems1 $newitems2 $newitems3.... and so on. The number of newitems will vary from week to week. On the multiple pages that pull information from the rss_master.php page, there are references to the newitems like this: $rss_writer_object->additem($newitems1); $rss_writer_object->additem($newitems2); $rss_writer_object->additem($newitems3); My problem: I'd like to make some sort of reference or loop or something that no matter how many $newitems1, newitems2, newitems3, newitems4, etc. that I have listed in the rss_master.php page, the multiple feed pages will pick up all the $newitems_ without direct referencing each line "$rss_writer_object->additem($newitems1);" like I have above. Any help would be appreciated.
Well, you can do this way on the rss_master.php $newitems[$week] = "value"; better that a lot of variables and use foreach ($newitems as $item) { $rss_writer_object->additem($item); } had you understand?
can you remodify your variables and put it into array? i mean array_push each variable so you dont have that much problem in referencing.
Oh, thank you! I was pretty sure I needed a loop, and had tried the foreach loop, but didn't have the clause set correctly. I ended up with the following: I put this in the rss_master.php $newitemsall= array($newitems1,$newitems2,$newitems3,$newitems4) so I can just add new array items as needed in my master. In the multiple pages I put the loop as suggested, with minor adjustments: foreach ($newitemsall as $newitem) { $rss_writer_object->additem($newitem); } I'm relatively new to PHP and didn't have the value set correctly before. I think I'm getting this now! Thanks so much for the help! Maybe someday I'll be skilled enough to help someone else!
No doubt about it! You just have to be persistent and keep programming! If you stop for a period of time, you'll become rusty, so you must continue to program. At least a different project every couple of days (depending on complexity) to keep your skills sharp and learn new things! Good luck! Don't be shy if you have any more questions, just create some posts! Regards, Dennis M.