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

[eluser]pickupman[/eluser]
How are you creating your form open tag? Your urls' should work no matter what or how they are created.
#12

[eluser]spletta[/eluser]
Like this...

I'm doing some templating which looks like this in my file system: views/includes/footer.php & header.php & template.php
When a View has a controller named contact.php then under the /views folder I made a contact/ folder and named the view index.php

contact/index.php
Code:
<div id="contact_form">
  <h1>Contact Us, Fool!</h1>
  &lt;?php
  echo form_open('contact/submit');
  echo form_input('name', 'Name', 'id="name"');
  echo form_input('email', 'Email', 'id="email"');
  $data = array('name' => 'messages', 'cols' => 35, 'rows' => 12);
  echo form_textarea($data, 'Message', 'id="message"');
  echo form_submit('submit', 'Submit', 'id="submit"');
  echo form_close();
  ?&gt;
</div>

controllers/contact.php
Code:
&lt;?php

class Contact extends Controller
{
  
  function index()
  {
    $data['main_content'] = 'contact/index';
    $this->load->view('includes/template', $data);
  }
  
  function submit()
  {
    $name = $this->input->post('name');
    // email.. store in db etc.
    // then ...
    
    $data['main_content'] = 'contact/contact_submitted';
    
    if ($this->input->post('ajax'))
    {
      $this->laod->view($data['main_content']);
    }
    else
    {
      $this->load->view('includes/template', $data);
    }
  }
}

The only thing I'm doing different from the tutorials I'm following is organizing my views into folders with the same name as the controller.. I'm not sure if that causes this.. well I just tested that actually and it still acts the same.

Could it be that I'm naming the views index.php? They seem to work otherwise? Nope I just tested that too... Confusedmirk:
#13

[eluser]sqwk[/eluser]
Why don't you just use plain old html and an absolute path to your css file

Code:
&lt;link rel="stylesheet" href="/system/application/css/style.css" type="text/css" /&gt;

Also it looks like your system directory is inside your web_root. If I were you I would use a folder structure like this instead: (more secure)

-home
-signaleast
- application
- system
- web_root

You can configure the absolute paths to the application folder and system in your index.php file. (/home/signaleast/application and /home/signaleast/system)
However, you will need to tell your host that the website is now in your web_root folder and not in signaleast. Depending on your host you might be able to do this yourself through a control panel or you might have to phone them up…
#14

[eluser]spletta[/eluser]
I have the chance to edit my apache server.. but I thought if I moved the application folder up one directory to (home/signaleast/codeigniter/application) of course then /system would be at the same level.. that I just need to edit the main index.php to correctly point to the new position of the /application folder?

If that's correct.. would it look something like this?
Modified
Code:
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
    $system_folder = "system";

/*
|---------------------------------------------------------------
| APPLICATION FOLDER NAME
|---------------------------------------------------------------
|
| If you want this front controller to use a different "application"
| folder then the default one you can set its name here. The folder
| can also be renamed or relocated anywhere on your server.
| For more info please see the user guide:
| http://ellislab.com/codeigniter/user-guide/general/managing_apps.html
|
|
| NO TRAILING SLASH!
|
*/
    $application_folder = "../application";

/*
|===============================================================
| END OF USER CONFIGURABLE SETTINGS
|===============================================================

Original
Code:
&lt;?php

|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
    $system_folder = "system";

/*
|---------------------------------------------------------------
| APPLICATION FOLDER NAME
|---------------------------------------------------------------
|
| If you want this front controller to use a different "application"
| folder then the default one you can set its name here. The folder
| can also be renamed or relocated anywhere on your server.
| For more info please see the user guide:
| http://ellislab.com/codeigniter/user-guide/general/managing_apps.html
|
|
| NO TRAILING SLASH!
|
*/
    $application_folder = "application";

/*
|===============================================================
| END OF USER CONFIGURABLE SETTINGS
|===============================================================
#15

[eluser]pickupman[/eluser]
I would suggest comparing the url of the stylesheets on when it works and when it doesn't. Use firebug or similar. Open the page, copy the url of the page, and the url of the stylesheet. Click on the link of the stylesheet and see where the link goes. Now compare the two or working and not working.

Is it not working when you have a 2nd/3rd/4th parameter in the uri?
#16

[eluser]sqwk[/eluser]
That depends where your index.php is. I use something like this:

Code:
- home/
  -signaleast/
      - application/        // Your application
      - system/                // The Codeigniter Stuff
      - web_root/            // This folder is what a visitor to your site would see. You will need to configure your host to change the folder
            -index.php         // Your edited index.php file
            - css/            // All your css stuff goes in here
            - js/            // All your javascript stuff goes in here

index.php would then have the path "/home/signaleast/application" or "../application" to reference the application folder. Your choice whether you use an absolute path or a relative one.

The css bit would then look like this:

Code:
&lt;link rel="stylesheet" href="/css/style.css" type="text/css" /&gt;
#17

[eluser]sqwk[/eluser]
Also look here on relocating your application or system folder:http://ellislab.com/codeigniter/user-gui..._apps.html
#18

[eluser]spletta[/eluser]
I'm not exactly sure I follow..

The contact.php controller submit function pulls up my views/contact/contact_submitted.php view

http://home.signaleast.com/contact/submit

When the css is referenced this way it works
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;

When its referenced this way.. it doesn't
Code:
&lt;link rel="stylesheet" href="./system/application/css/style.css" type="text/css" media="screen" charset="utf-8"&gt;
#19

[eluser]sqwk[/eluser]
You do not need the &lt;?php echo base_url();?&gt; All it does is replace itself with http://home.signaleast.com/. You can just use a "/" to get the same effect.
#20

[eluser]spletta[/eluser]
true true




Theme © iAndrew 2016 - Forum software by © MyBB