CodeIgniter Forums
.htaccess issue I could use some assistance - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: .htaccess issue I could use some assistance (/thread-32642.html)



.htaccess issue I could use some assistance - El Forum - 07-29-2010

[eluser]draconus[/eluser]
I am using a calendar plugin I found for codeignitor, and it is pretty, but, it is giving me .htaccess issues. I am not sure what the deal is.

I wrote my htaccess file to rewrite out the index.php, but one function within the calendar controller seems to still be enforcing that I use the index.php

here is my htaccess file:
Code:
RewriteEngine On
RewriteBase /

RewriteCond $1 !^(index\.php|assetts|css|img|images|js|themes|install|files|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]

And here is the function that seems to need index.php in the url:
Code:
function index(){
        // The forth segment will be used as timeid
        $timeid = $this->uri->segment(3);
        if($timeid==0)
            $time = time();
        else
            $time = $timeid;

        // we call _date function    
        $data = $this->_date($time);

        // Set all other variables here
        $data['title'] = "Manage Calendar";
        $data['header'] = 'NFF | Events Calendar';
        $this->load->view('calendar_home', $data);
    }

in the view side of things, the url for current month view is like this:
http://nff/calendar

but when I click next month, which passes a timestamp in uri segment 3, it requires the url be like this(as an example):
http://nff/index.php/calendar/index/1280635200


.htaccess issue I could use some assistance - El Forum - 07-29-2010

[eluser]draconus[/eluser]
Just in case its needed, here is the view code in question:

Code:
<?php
            if ($this->session->flashdata('message')){
                echo "<div class='status_box'>".$this->session->flashdata('message')."</div>";
            }
            ?&gt;
                <table id="calendar" cellspacing="0">
                    <thead>
                    <tr>
                        <th>
                            &lt;?php echo anchor('calendar/index/'.$previous_month,'&laquo;', array('title'=>$previous_month_text));?&gt;
                        </th>
                        <th id="month" colspan="5">&lt;?=$current_month_text?&gt;</th>
                        <th>
                            &lt;?php echo anchor('calendar/index/'.$next_month,'&raquo;', array('title'=>$next_month_text));?&gt;
                        </th>
                    </tr>
                    <tr>
                        <th>Sun</th>
                        <th>Mon</th>
                        <th>Tue</th>
                        <th>Wed</th>
                        <th>Thu</th>
                        <th>Fri</th>
                        <th>Sat</th>
                    </tr>
                    </thead>
                    <tr>
                        &lt;?php
                        for($i=0; $i< $total_rows; $i++)
                        {
                            for($j=0; $j<7;$j++)
                            {
                                $day++;                    
                    
                                if($day>0 && $day<=$total_days_of_current_month)
                                {
                                    //YYYY-MM-DD date format
                                    $date_form = "$current_year/$current_month/$day";
                        
                                    echo '<td';
                        
                                    //check if the date is today
                                    if($date_form == $today)
                                    {
                                        echo ' id="today"';
                                    }
                        
                                    //check if any event stored for the date
                                    if(array_key_exists($day,$events))
                                    {
                                        //adding the date_has_event class to the <td> and close it
                                        echo ' class="date_has_event"> ';
                                        echo anchor("calendar/dayevents/".$current_year."-".$current_month."-".$day,$day);
                            
                                        //adding the eventTitle and eventContent wrapped inside <span> & <li> to <ul>
                                        echo '<div class="events"><ul>';
                            
                                        foreach ($events as $key=>$event){
                                            if ($key == $day){
                                              foreach ($event as $single){
                                                  echo '<li>';                    
                                                echo anchor("calendar/edit/$single->id",'<span class="title">'.$single->eventTitle.'</span><span class="desc">'.$single->eventContent.'</span>');                        
                                                echo '</li>';
                                              } // end of for each $event
                                            }
                                  
                                        } // end of foreach $events
                            
                            
                                        echo '</ul></div>';
                                    } // end of if(array_key_exists...)
                    
                                    else
                                    {
                                        //if there is not event on that date then just close the <td> tag
                                        echo '> '.$day;
                                    }
                                    echo "</td>";
                                }
                                else
                                {
                                    //showing empty cells in the first and last row
                                    echo '<td class="padding">&nbsp;</td>';
                                }
                            }
                            echo "</tr><tr>";
                        }
            
                        ?&gt;
                    </tr>
                </table>
            </div>

Any help would be appreciated, since it makes no sense to me why the passing of the variables into the function is causing the routing issue...


.htaccess issue I could use some assistance - El Forum - 07-29-2010

[eluser]draconus[/eluser]
Bump!

Any ideas guys? I am willing to share whatever code I must to make this uri bug go away, as it screws with the nice uri scheme I am working on achieving.