CodeIgniter Forums
scaffolding and image_url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: scaffolding and image_url (/showthread.php?tid=2101)



scaffolding and image_url - El Forum - 07-16-2007

[eluser]MattKern[/eluser]
Hello

Brand new here and going thru the tutorials. I seem to be having some image path problems with scaffolding but not quite sure why.

I am printing the line from the css file in header.php and the path looks good:

http://localhost/codei1/system/scaffolding/images/background.jpg

but images that are specified in the scaffolding css file don't appear.

background: #fff url(<?php echo $image_url; ?>background.jpg) repeat-x left top;

Am I missing something?

Thanks a bunch. I look forward to diving in to CI.

Matt


scaffolding and image_url - El Forum - 07-16-2007

[eluser]Derek Allard[/eluser]
Hey Matt,

Welcome to CI! Are you getting any errors generated? I famously borked scaffolding a few days ago when we released CI, so if your copy is more then a few hours old, could you grab a new download and tell me if it still affects you?


scaffolding and image_url - El Forum - 07-16-2007

[eluser]MattKern[/eluser]
Thanks Derek, I am set to check out your tutorial next...

I just downloaded a fresh version and re-typed all the blog tutorial code up to scaffolding and I am still getting the same result.

I am setting this in config.php

$config['base_url'] = "http://localhost/codei1/";

are there any other paths I need to setup in the beginning?

I am not getting any error messages, but when I right click (PC) and say "View background image", I get a 404 as it goes to this path.

http://localhost/codei1/system/scaffolding/images/background.jpg

scaffolding itself works fine, though. - also - the page is styled correctly so it is definately finding the css file OK.

Thanks

Matt


scaffolding and image_url - El Forum - 07-16-2007

[eluser]MattKern[/eluser]
Yikes.

Just figured it out. My .htaccess was messing it up. I don't think I am accounting for the /codei1/folder correctly.

I deleted the .htaccess and it worked fine.

I grabbed this .htaccess from the user guide. How do I account for /codei1/ ?
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

Thanks

Matt


scaffolding and image_url - El Forum - 07-16-2007

[eluser]Derek Allard[/eluser]
Phew!

If you told me I had another error in there.. Wink


scaffolding and image_url - El Forum - 07-16-2007

[eluser]MattKern[/eluser]
The chances of me finding your errors at this point are VERY slim... Wink


scaffolding and image_url - El Forum - 07-16-2007

[eluser]esra[/eluser]
Derek... I don't use scaffolding, but I'm curious about where the $image_url value is set--that is, in the controller, a helper, or elsewhere. Also, is the long format used because short tags do notwork in a css file?


scaffolding and image_url - El Forum - 07-16-2007

[eluser]MattKern[/eluser]
Sorry, I know I am not Derek....

$image_url is in Scaffold.php

Code:
// Set a few globals
$data = array(
'image_url'    => $this->CI->config->system_url().'scaffolding/images/',
'base_uri'  => $this->base_uri,
'base_url'    => $this->base_url,
'title'        => $this->current_table
);

Short tags do work in the css file if they are enabled.


scaffolding and image_url - El Forum - 07-16-2007

[eluser]Derek Allard[/eluser]
How dare you! >Sad

...

kidding... kidding... thanks Matt!


scaffolding and image_url - El Forum - 07-16-2007

[eluser]MattKern[/eluser]
...I just play Derek on the internet...

using php like that, in the css file, in a normal php scenario wouldn't usually work, right? Does that mean that the css file actually gets parsed by the php engine? That means that you can do some nifty things like assign colors dynamically (color:<?=$color_set1?&gtWink etc... without having to actually spit out the css file.

Any thoughts on my .htaccess problem?

Thanks

matt