• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Got a problem.

#1
[eluser]Neclord02[/eluser]
Im trying to put a html page into codeigniter, so here's the issue:

My controler:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

public function index()
{
            
            $data = array('title = Welcome to Good Cook');
          
            
            $this->load->view('Main_view' , $data);
            
}
}

Then, on the main_view, w/o changing anything into php, I get some data when I try it on my browser; problem is when i try to set lines like these:

Code:
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">

into this:

Code:
<link rel="stylesheet" href="<?php echo base_url(); ?>css/reset.css" type="text/css" media="all">

All the information dissapears, dunno why (I obviously got this files into the correct folders already)

Any hints on what I'm doing wrong here?

#2
[eluser]Mirge[/eluser]
Code:
$data = array('title' => 'Welcome to Good Cook');

Otherwise, I don't know what your actual "problem" is? What's happening?

View source, look at the href for the stylesheet & make sure it exists.

#3
[eluser]Neclord02[/eluser]
You were right on that. But that's not the point:

I've got a header as follows:

Code:
<meta charset="utf-8">
    <link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
    <link rel="stylesheet" href="css/style.css" type="text/css" media="all">
    <link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
    <link href='http://fonts.googleapis.com/css?family=Adamina' rel='stylesheet' type='text/css'>  
    [removed][removed]
    [removed][removed]

When i change it to:

Code:
<meta charset="utf-8">
    <link rel="stylesheet" href="<?php echo base_url(); ?>css/reset.css" type="text/css" media="all">
    <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css" type="text/css" media="all">
    <link rel="stylesheet" href="<?php echo base_url(); ?>css/layout.css" type="text/css" media="all">
    <link href='<?php echo base_url(); ?>http://fonts.googleapis.com/css?family=Adamina' rel='stylesheet' type='text/css'>  
    [removed][removed]
    [removed][removed]
    [removed][removed]

I get a blank page on my browser.

#4
[eluser]CroNiX[/eluser]
Maybe the last line is messing it up where you are including the base_url(), but the actual URL is on googles server, not yours.

Also, what's your base_url set to?

Check your apache logs for 404 errors and see what path it's trying to access.

Do you have error reporting turned on and set to display errors? Blank pages usually indicate suppressed errors.

#5
[eluser]Mirge[/eluser]
Did you:

Code:
$this->load->helper('url');

First?

Autoload it if you want, edit your config/autoload.php file.

#6
[eluser]TWP Marketing[/eluser]
[quote author="Neclord02" date="1345746504"]You were right on that. But that's not the point:

I've got a header as follows:

Code:
<meta charset="utf-8">
    <link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
    <link rel="stylesheet" href="css/style.css" type="text/css" media="all">
    <link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
    <link href='http://fonts.googleapis.com/css?family=Adamina' rel='stylesheet' type='text/css'>  
    [removed][removed]
    [removed][removed]

When i change it to:

Code:
<meta charset="utf-8">
    <link rel="stylesheet" href="<?php echo base_url(); ?>css/reset.css" type="text/css" media="all">
    <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css" type="text/css" media="all">
    <link rel="stylesheet" href="<?php echo base_url(); ?>css/layout.css" type="text/css" media="all">
    <link href='<?php echo base_url(); ?>http://fonts.googleapis.com/css?family=Adamina' rel='stylesheet' type='text/css'>  
    [removed][removed]
    [removed][removed]
    [removed][removed]

I get a blank page on my browser.[/quote]

Two things:
Have you moved your css directory out of the root?

Did you copy the googleapis css to your local site? If not, it can't find them. I would leave the google css link unchanged.

#7
[eluser]Neclord02[/eluser]
[quote author="Mirge" date="1345747018"]Did you:

Code:
$this->load->helper('url');

First?

Autoload it if you want, edit your config/autoload.php file.[/quote]



... I'm such a n00b, thanks a lot m8!

#8
[eluser]Mirge[/eluser]
Happy to help


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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