English 中文(简体)
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

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签