开发者

I need help parsing a PHP array for an embedded Google Calendar

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;src=cjvssf4vj98hoa4os5hr26fmcg%40group.calendar.google.com"></iframe>

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.


I think I solved this with foreach:

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

/noob

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜