views:

76

answers:

2

I'm not sure I'm headed on the right path but what I want to do is have an embedded Google Calendar with multiple calendars encoded in the iframe source. Example:

<iframe src="https://www.google.com/calendar/embed?src=cjvssf4vj98hoa4os5hr26fmcg%40group.calendar.google.com&amp;amp;src=cjvssf4vj98hoa4os5hr26fmcg%40group.calendar.google.com"&gt;&lt;/iframe&gt;

Notice the two sources (the resource IDs happen to be the same in this example, but in a real scenario they'd be different). What I want to do now is create an array that would let me put the name of the calendar and its resource ID. Example:

<?php $rsrcid = array('Some Calendar' => 'cjvssf4vj98hoa4os5hr26fmcg%40group.calendar.google.com',); ?>

And use this array to replace that chunk of src=, etc. so that it's easier to keep track of all these resource ID's (I plan on adding a few dozen). It would need to have concatenated to it the &src= to each line. No spaces. So that it's a long string that I can insert into the iframe src.

It should be noted I'm not at all good at writing my own PHP, so if I'm even thinking incorrectly please let me know. Does that make sense?

Thanks for reading.

A: 

Do you mean you want to have an array and have the array loop through for each calendar and write separate iframes dynamically?

gonzofish
farkenfooken
+1  A: 

I think I solved this with foreach:

        <?php
        foreach ($rsrcid as $name => $id){
          echo '&amp;src=' . $id;
        }
        ?>

/noob

farkenfooken