私は (ちょっと) Web 開発 (ほとんどがデスクトップ開発者) の初心者で、CodeIgniter を使用して問題に遭遇しました。これは Calendar Library です。
私の問題は、カレンダーを生成すると、関数に渡す URL が現在の URL の末尾に追加されることです! 関連するコードは次のとおりです。
//リンク生成コード
//Get numbers of days in month
$day_count = cal_days_in_month(CAL_GREGORIAN, $month, $year);
//For each day of the month, check for appointments
for($i = 1; $i <= $day_count; $i++)
{
//Create date array
$date = array
(
'year' => $year,
'month' => $month,
'day' =>$i
);
if ($this->appointment_model->get_appointment_dates($date))
{
//If there is an appointment, add link
$appointment_data[$i] = 'view_day'. '/' . $year . '/' .$month;
}
}
//カレンダー テンプレート
$calendar_template ='
{table_open}<table border="1" cellpadding="0" cellspacing="0">{/table_open}
{heading_row_start}<tr>{/heading_row_start}
{heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
{heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
{heading_row_end}</tr>{/heading_row_end}
{week_row_start}<tr>{/week_row_start}
{week_day_cell}<td>{week_day}</td>{/week_day_cell}
{week_row_end}</tr>{/week_row_end}
{cal_row_start}<tr>{/cal_row_start}
{cal_cell_start}<td>{/cal_cell_start}
{cal_cell_content}<a href="index.php/calendar/{content}/{day}">{day}</a>{/cal_cell_content}
{cal_cell_content_today}<div class="highlight"><a href="index.php/calendar/{content}/{day}">{day}</a></div>{/cal_cell_content_today}
{cal_cell_no_content}{day}{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
{cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}
';
カレンダーの URL は次のとおりです。
http://localhost:8888/AI_Project/index.php/calendar/view_appointments/2013/06
カレンダーに追加されたリンクは次のようになります。
http://localhost:8888/AI_Project/index.php/calendar/view_appointments/2013/index.php/calendar/view_day/2013/06/18
これがなぜなのかわかりません。どんな助けでも大歓迎です。他に何か必要な場合はお知らせください。
ありがとうございました!