Welcome Guest, Not a member yet? Register   Sign In
problem with putting css style
#11

[eluser]danmontgomery[/eluser]
/theme/style.css is an absolute web path... This is still not entirely portable, as it will break in any installation except for webroot (if your application is located at http://www.mydomain.com/my_app, this will not work). It's best to use an html BASE tag, or construct your asset paths using base_url() or site_url() like others have said here. There are also plenty of examples of this on the forums if you search.
#12

[eluser]Niebieszki[/eluser]
sorry, have somebody a solution of my problem? I've tried all of them and it doesn't work.

Let's start from begining.

1. downloading clean sorce of CI
2. move out the application folder out of the system folder
3 create folder named themes on the root folder next to application system etc - inside i create style named style.css
4. a create new view i application/view folder named test.php

what path to css style should I write?
Maybe I must do sth more (maybe sth depends from moving application out from system -maybe s should change
Code:
$application_folder = "application";

when I change it to
Code:
$application_folder = "../application";

it make mistake.
#13

[eluser]victorche[/eluser]
Just put in the head section of /view/test.php this:
Code:
<link rel="stylesheet" href="/themes/style.css" type="text/css" media="screen" />
This has nothing to do with your application folder.
Besides, why don't you just use CI 2.0? In 2.0 application folder is out of the system folder by default. And CI 2.0 is mature and stable enough for production use. Expression Engine is built upon 2.0 ...
#14

[eluser]techgnome[/eluser]
Relative links wouldn't work in my case... my local htdocs folder is empty except for the folders for the half dozen or so websites I'm working... so using /themes/style.css won't work in my case.

Inside each controller, I have the following lines:
Code:
var    $base;
  var    $css;
  var     $images;
Then in the constructor of each controller:
Code:
$this->base = $this->config->item('base_url');
        $this->css = $this->config->item('css');
        $this->images = $this->config->item('images');
(note the CSS and Images config settings are ones I added to the config file myself.) Each of these are then passed to the view as is the rest of my data.

At the site root (which is one level down from localhost root) I have application, system, and public... public then has a css folder, js folder, images folder and others that are not related to CI in any way.

To write out my css link, I have this in my view template:
Code:
<link href="<?php echo $base . $css ?>" rel="stylesheet" type="text/css" />

-tg
#15

[eluser]Niebieszki[/eluser]
I think where the problem is with loading css style. In my project i use short links with file .htaccess

Quote:RewriteEngine on
RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
RewriteCond $1 !^(index.php|images|robots.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]

what now should look the path to css style?
#16

[eluser]Niebieszki[/eluser]
is a relationship with having a .htaccess file and a path ( like generate base_url()Wink?

Any ideas what should now look my path to css style?
#17

[eluser]Niebieszki[/eluser]
any ideas?
#18

[eluser]John_Betong[/eluser]
In the header, Immediately before the CSS calling script I use:

Code:
<?php echo getcwd(); ?>

  <link rel="stylesheet" href="/PATH TO BE SET/style.css" type="text/css" media="screen" />

From the results of getcwd() I set the relevant path;

Works for me Smile
#19

[eluser]Niebieszki[/eluser]
Sad it's don't help.

the code create paths like

Quote:C:\xampp\htdocs\app/css/styl.css
when I past in the url bar it load the file but when I use it in style tag it doesn't
#20

[eluser]John_Betong[/eluser]
OK copy and paste and try this in your header until you find the path to your CSS file;

Code:
echo '<br />' .base_url();
  echo '<br />' .base_url() .APPPATH;
  echo '<br /><br />'.
  $css = base_url() .'css/styl.css';
  if (file_exists($css))
  {
    echo 'Success';
  }
  die('<br />The path is incorrect - try again.');
&nbsp;
&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB