Welcome Guest, Not a member yet? Register   Sign In
  default controller in sub dir doesnt work
Posted by: El Forum - 06-21-2007, 12:08 AM - No Replies

[eluser]the real rlee[/eluser]
Hi guys not sure this is related to this bug post about sub applications, but i\'ve found i keep getting 404\'s when i set the default_controller to a controller within a subdir. A few echo statements reveals that the class name for the default controller is not getting set properly in Routes.php - it seems to be using the controller path and not the controller name!

Router.php (line 109):

Code:
$this->set_class($this->default_controller);
// is actually setting the class to subdir/controller

And then CodeIgniter.php creates the 404 (line 158):
Code:
$class  = $RTR->fetch_class(); // is subdir/controller
$method = $RTR->fetch_method();
// does a class called \"subdir/controller\" exists - of course not!
if ( ! class_exists($class)
   OR $method == \'controller\'
   OR substr($method, 0, 1) == \'_\'
   OR in_array($method, get_class_methods(\'Controller\'), TRUE)
   )
{


  need help with a mod_rewrite :)
Posted by: El Forum - 06-20-2007, 10:50 PM - No Replies

[eluser]the real rlee[/eluser]
Hi I\'m using the stock CI mod rewrite to get rid of the \"index.php\" at the start of my URI\'s, but i\'d like to extend this rewrite to make the server redirect any request bar user/... main/.. to a specific controller function. The situation is my main website has a number of subsites which look like www.mysite.com.au/joebloggs which needs to be passed to my Sites controller i.e. www.mysite.com.au/joebloggs - > Sites/index/joebloggs.

Your help greatly appreciated!

Code:
# CI needs PATH_INFO
<Files \"index.php\">
AcceptPathInfo On
</Files>

# Check mod_rewrite is enabled
<IfModule mod_rewrite.c>
# Lets remove index.php from URI...
RewriteEngine On\nRewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If mod_rewrite isn\'t enabled try and
# forward request to index.php

ErrorDocument 404 index.php

</IfModule>
"


  Noob: Trouble using Models, Parse Errors & The like occur :(
Posted by: El Forum - 06-20-2007, 09:53 PM - No Replies

[eluser]Unknown[/eluser]
I must start off by saying I\'m usually the type to just get really stubborn and figure it out on my own but this time I must admit I really need some help Tongue

Okay so lets get into it. I decided to use CI to code my website because I wanted to create a lean, very simple content managing system. Right now I\'m trying to pull text out of a database and display it on a page. I keep getting PHP Parse errors however, having messed around with it and getting different error messages Tongue
Here\'s what I have now:
Parse error: syntax error, unexpected T_STATIC, expecting T_STRING in [...]/system/application/models/static.php on line 2

Here\'s the code for my Model (it exists in the models folder as static.php):

Code:
&lt;?php
class Static extends Model {

var $content    = \'\';

   function Static()
   {
       parent::Model();
   }
    function show_about_block()
   {
   $sql = \"SELECT content FROM static LIMIT 1\";
    
$this->db->query($sql);
   return $this;
   }
    }
    ?&gt;

I\'m guessing you\'ll need the
controller and the View too so here goes:
Controller (exists in controllers folder as
home.php):
Code:
&lt;?php

class Home extends Controller {

   function Home()
   {
    
parent::Controller();    
   }
   
   function index()
   {
    
$this->load->model(\'static\');
               $data[\'about\'] =
$this->static->show_about_block();
       $this->load->view(\'home_page\', $data);
        
}
}
?&gt;
And Finally View (exists in views folder as
home_page.php):
Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;DeadRinger&lt;/title&gt;
&lt;!--
(REMOVED CSS TO SAVE SPACE IN THIS POST) ->
&lt;/head&gt;
&lt;body&gt;

<h1>DeadRinger Media -
COMING SOON</h1>

<p>Test:</p>

<p>&lt;?php echo $about
?&gt;</p>

&lt;/body&gt;
&lt;/html&gt;

Let me know if you\'ll want information about my
Database too! Thanks so much in advance! I\'ll see if perhaps I can return the favor somehow.

Thanks
again,
Sean"


  Blank page
Posted by: El Forum - 06-20-2007, 09:26 PM - No Replies

[eluser]K-C[/eluser]
I encountered some wierd things.

My CI code is working fine in my local machine but when I upload to the server, some pages are loaded properly and some are just blank page.

Any clue on why such things happen?


  carousel Fatal error: Call to undefined function: imagecreatefromjpeg() in
Posted by: El Forum - 06-20-2007, 09:13 PM - No Replies

[eluser]Unknown[/eluser]

Hello im jerry,
i would like to get some help to pros out there coz im new at code igniter..
wen i first tym uploaded the scripts of CI the error that welcomes me
is this one.
carousel Fatal error: Call to undefined function: imagecreatefromjpeg() in
is there anyone can help my proble Thank you very much and may ur God Bless You! :-)


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Heads up for users using ...
by InsiteFX
3 hours ago
The Hidden Cost of “Innov...
by fcoder
4 hours ago
tool bar not showing
by InsiteFX
10 hours ago
Tool bar not showing
by InsiteFX
10 hours ago
Validation does not appea...
by grimpirate
Yesterday, 01:55 PM
Block IP addresses of bad...
by grimpirate
Yesterday, 01:47 PM
Override Router
by grimpirate
Yesterday, 01:30 PM
CodeIgniter.com - Report ...
by Vikas Mehta
06-30-2025, 10:30 AM
best way to store tokens ...
by ahallrod
06-30-2025, 10:03 AM
Hey Now it is a time for ...
by J0shflynn
06-29-2025, 06:44 AM

Forum Statistics
» Members: 154,327
» Latest member: bdifferentclothing
» Forum threads: 78,435
» Forum posts: 379,706

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB