Problem with URL

[eluser]The Beginner[/eluser]
Hi guy's, I have gotten my main index page finished and it is working great finnally. Now I am building content pages and am having problems getting the content data to load. My Controller code is below. I am using a view file called wpContainer.php to display all pages. I am loading my content data in a model file. When the menu item for streetrods is clicked my URL is changing accordingly but the function that loads the new content data never gets called.
URL when the app starts is "http://localhost/index.php"
when the menu item is clicked the url changes to: "http://localhost/index.php/wpapp/streetrods/"

class Wpapp extends Controller {
    function Wpapp()
    function streetrods()
        $content_data = '';
        $data = $this->wp_page_model->getHeaderData();
        $pagename = '"StreetRods"';
        $active = '1';
        $data['content_data'] = $this->wp_page_model->getContentData($pagename,$active);    
    //    $data['right_data'] = $this->wp_page_model->getRightPaneData();    
        $data['right_data'] = '';
        $data['menu'] = $this->wp_page_model->getMenuData();
        $data['footer'] = '';
        $data['test'] = 'This is a test to see if this function is being called or not......';
    function index()
    {   //Get the data for the page header (logo, site tittle & text);
        $data = $this->wp_page_model->getHeaderData();
        $pagename = '"MainPage"'; //if I change this to '"StreetRods"' it loads the street rods data
        $active = '1';
        $data['content_data'] = $this->wp_page_model->getContentData($pagename,$active);    
        $data['right_data'] = '';
        $data['menu'] = $this->wp_page_model->getMenuData();
        $data['footer'] = '';
        $data['test'] = 'The test is on....';
/* End of file wpApp.php */
/* Location: ./wpapp/controllers/wpApp.php */

Any suggestions would be greatly appreciated



It would help if you show your view code for both functions.

Also you should load your model in the Constructor instead of both functions.


[eluser]The Beginner[/eluser]
Below is my view code for both functions;
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "" >&lt;html &gt;
&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
&lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt;
&lt;meta name="&lt;?php echo $site_name; ?&gt;" content="" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;wpapp/sources/styles/menu_style.css" type="text/css" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;wpapp/sources/styles/FrameSetStyle.css" type="text/css" /&gt;
<div id="pagewidth" >
    <div id="header" >&lt;?php echo $header_logo; ?&gt;    <id="menu">&lt;?php echo $menu; ?&gt;</div>
            <div id="wrapper" class="clearfix" >
                <div id="twocols" class="clearfix">
                    <div id="arr">[removed]completeimage()[removed]</div>    
                    <div id="rightcol" >&lt;?php echo $right_data; ?&gt; </div>
                <div id="leftcol" >
                         echo $content_data;      
            <div id="footer" > <id="menu">&lt;?php echo $menu; ?&gt;
                <td align= "center">* prices subject to change without notice</td>
                <td align="left" valign="top"><span class='footnote'><br> © Copyright 2009 Web Promotions, LLC.<br>
                All Rights Reserved.</span></td>
                &lt;?php echo $test;?&gt;
                <td align="right"></td>

[eluser]The Beginner[/eluser]
I added this line in the index: $data['test'] = 'The test is on....';
and this line in streetrods: $data['test'] = 'This is a test to see if this function is being called or not......';

I did this so i could tell if the street rods function was being executed. Unfortunately I do not have debugging installed so I cannot step through the code.
I have downloaded a tutorial from the CI Wiki and ran it to see if it worked, and it seams to have a similar problem. The tutorial is Jeffrey Way's day 6 "Login Fool" tutorial. I thought maybe it is something about the way my local server was set up. So I copied a fresh version from the downloaded zip file up to my remote server and I got exactly the same response as on my local server. On the tutorial any time I click the login button or the signup button I get an error Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

Error 404
10/4/2009 11:44:47 AM
Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0

When I run the code for my app listed above and I click the menu item for streetrods it simply redisplays the index page.

[eluser]The Beginner[/eluser]
Actually I went back to my remote server and corrected my base_url and now I am getting the exact same situation as with my app.

The path for my app is:

//$config['base_url'] = "http://localhost/";
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

The actual path to my localhost is: "C:\xamp\htdocs\"
In my local index.php file this is: $application_folder = "wpapp";

Any suggestions would be greatly appreciated.

[eluser]The Beginner[/eluser]
Hey guy's,
I solved the problem. Ok, so I am a newbie and most of you may have caught this long before. But, the fix was "$config['uri_protocol'] = "AUTO"; I had this set to :
"$config['uri_protocol'] = "QUERY_STRING";" using auto all my apps work fine.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.