Welcome Guest, Not a member yet? Register   Sign In
CSS is being generated?
#1

[eluser]spletta[/eluser]
Hello fellow igniters,

I'm having trouble getting my CSS to work. I've read the other forum discussions on this, but still can't figure it out. Is there a CSS guide I'm missing (was mentioned in one of the posts)?

The wierdest thing is when you open http://home.signaleast.com/email in firefox.. my css file is not found and there is some wierd generated css there.. any ideas?

Code:
&lt;html&gt;&lt;"This is a normal script src tag(added in for this post)"="http://1.2.3.4/bmi-int-js/bmi.js" language="javascript"></closing script tag>&lt;head&gt;&lt;title>404 Page Not Found&lt;/title&gt;
&lt;style type="text/css"&gt;body{background-color:#fff;margin:40px;font-family:Lucida Grande,Verdana,Sans-serif;font-size:12px;color:#000;}#content{border:#999 1px solid;background-color:#fff;padding:20px 20px 12px 20px;}h1{font-weight:normal;font-size:14px;color:#990000;margin:0 0 4px 0;}&lt;/style&gt; &lt;/head&gt;&lt;body><div id="content"><h1>404 Page Not Found</h1><p>The page you requested was not found.</p></div>&lt;/body&gt;&lt;/html><opening script language="javascript">&lt;!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img",0);//--&gt;
</closing script tag>
Where is that coming from?

Here is my Controller:
Code:
&lt;?php
  class Email extends Controller
  {
  
    function __construct()
    {
      parent::Controller();
    }
    
    function index()
    {
      $this->load->view('newsletter/index');
    }
    
    function send()
    {
      $this->load->library('form_validation');
      
      // field name, error message, validation rules
      $this->form_validation->set_rules('name', 'Name', 'trim|required');
      $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');

      if($this->form_validation->run() == FALSE)
      {
        $this->load->view('newsletter/index');
      }
      else
      {
        // validate has passed. Now send the email
        $name = $this->input->post('name');
        $email = $this->input->post('email');
        
        $this->load->library('email');
        $this->email->set_newline('\r\n');
      
        $this->email->from('[email protected]', 'Remington Splettstoesser');
        $this->email->to($email);
        $this->email->subject('This is email text');
        $this->email->message('Its working');
      
        $path = $this->config->item('server_root');
        $file = $path . 'system/attachments/yourinfo.txt';
      
        $this->email->attach($file);
      
        if($this->email->send())
        {
          //echo 'Your email was sent, fool.';
          $this->load->view('signup_confirmation_view/index');
        }
      
        else
        {
          show_error($this->email->print_debugger());
        }
      }  
    }
  }
/* End of file helloworld.php */
/* Location: sysytem/appplication/controllers/ */



Here is my view:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
    &lt;title&gt;untitled&lt;/title&gt;
    &lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;css/style.css" type="text/css" media="screen" charset="utf-8"&gt;
&lt;/head&gt;
&lt;body&gt;

<div id="newsletter_form">
    <h2>Newsletter</h2>
    &lt;?php echo form_open('email/send'); ?&gt;
    
    &lt;?php
    
    $name_data = array(
        'name' => 'name',
        'id' => 'name',
        'value' => set_value('name')
    );
    
    ?&gt;
    
    <p><label for="name">Name: </label>&lt;?php echo form_input($name_data); ?&gt;</p>
    
    <p>
        <label for="name">Email Address: </label>
        &lt;input type="text" name="email" id="email" value="&lt;?php echo set_value('email');?&gt;"&gt;
    </p>
    
    <p>&lt;?php echo form_submit('submit', 'Submit'); ?&gt;</p>
    
    &lt;?php echo form_close(); ?&gt;
    
    &lt;?php echo validation_errors('<p class="error">'); ?&gt;
    
</div>&lt;!--end newsletter-form--&gt;
&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]danmontgomery[/eluser]
It's Codeigniter's 404 page.
#3

[eluser]spletta[/eluser]
Yes, the file exists at /home/signaleast/codeigniter/system/application/css/style.css.. and my base_url is set to http://home.signaleast.com/

Apache points to /home/signaleast/codigniter/

Codeigniter (system) points to 'application'

Apache owns the file, and permissions are wide open

What am I missing?
#4

[eluser]spletta[/eluser]
Thats interesting.. I'm using a Wireless USB 3G card to access the internet and there is a script (bmi.js) that will run to keep the browser active.. but why would it block my css?
#5

[eluser]pickupman[/eluser]
Quote:/home/signaleast/codeigniter/system/application/css/style.css

This means you should be using:
Code:
&lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;application/css/style.css" type="text/css" media="screen" charset="utf-8"&gt;

You left application/ out of url.
#6

[eluser]spletta[/eluser]
Thank You for your help.. but that also doesn't work.. (404 error)
#7

[eluser]pickupman[/eluser]
[quote author="spletta" date="1278620442"]Thank You for your help.. but that also doesn't work.. (404 error)[/quote]

Since your url has index.php removed, you must be using mod_rewrite. Make sure you have the condition to check for files/directories.
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#8

[eluser]spletta[/eluser]
Yeah.. that is something I will read up on a little. I went back and removed the .htaccess all together so I would get a normal 404 Error.. not CI's. Then edited my link to look like this:

Since as stated above the file exists at /home/signaleast/codeigniter/system/application/css/style.css.
Code:
&lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;system/application/css/style.css" type="text/css" media="screen" charset="utf-8"&gt;


I expected CI to go straight to the 'application' folder though.. where is that defined again.. I saw it earlier today? I know it was pointing to 'application' .. hmmm

I put the .htaccess file (original version) back and that works as well.

Thanks for your help!
#9

[eluser]pickupman[/eluser]
All file paths are relative to CI's index.php. You could have /system or /application anywhere as long as they are defined correctly in index.php. Some would suggest leaving out the base_url() part, as it creates a another http request to resolve the address. Otherwise you could be using:
Code:
&lt;link rel="stylesheet" href="./system/application/css/style.css" type="text/css" /&gt;
#10

[eluser]spletta[/eluser]
An Interesting thing for me (still trying to push past n00b status) is when submitting a form with _POST.. it seems as though
Code:
&lt;?php echo base_url();?&gt;
is necessary.. otherwise the "submitted" view I'd like to show after the form is submitted comes back with no css. I wish I knew why.
Code:
function submit()
  {
    $name = $this->input->post('name');
    
    // email.. store in db etc.
    // then ...
    
    $data['main_content'] = 'contact/contact_submitted';
    $this->load->view('includes/template', $data);
  }
}
Works MOST of the time
Code:
&lt;link rel="stylesheet" href="./system/application/css/style.css" type="text/css" /&gt;

Works EVERY-TIME with (for submitting forms and logging in)
Code:
&lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;system/application/css/style.css" type="text/css" media="screen" charset="utf-8"&gt;




Theme © iAndrew 2016 - Forum software by © MyBB