Welcome Guest, Not a member yet? Register   Sign In
NEWBIE ? Re: Images
#1

[eluser]TVB_FSU[/eluser]
First of all, hello and thanks for providing this cool tool!

Now on to the question (forgive me if it's been asked/answered in the past - I searched and didn't find). I am at the earliest beginning stage of using CodeIgniter for form validation. I've played around with the example "myform" and got it to work and tweaked the look, etc. I cannot, however, figure out how to put images on my form. I've put an images folder under my "views" folder and also tried it under the "controllers" folder, but just can't get it to find them.

Also, possibly along the same lines, once I get this one to work, I will have two other forms to post. Is there a way to keep the existing links on the forms or do they have to all go to index.php?

Thanks in advance for your assistance!
#2

[eluser]wr5aw[/eluser]
This post might help - http://ellislab.com/forums/viewreply/482401/
#3

[eluser]TVB_FSU[/eluser]
Now I get the following error: "Fatal error: Call to undefined function site_url() in E:\inetpub\wwwroot\Forms\CI\system\application\config\config.php on line 320"

Here is what I added to the end of my config.php file (I added line numbers for this display):

317 $config = array (
318 'page_settings' =>
319 array (
320 'image_path' => site_url()."/images/",
321 'css_path' => site_url()."/css/",
322 'pdf_path' => site_url()."/pdf/",
323 )
324 );

Here is what I put in the form calling the image:

< img src="&lt;?php echo $image_path; ?&gt;tsrbanner2.jpg" width="625" height="65" >
#4

[eluser]dmiden[/eluser]
Hi, are you using the routing engine? Etc, www.example.com/controller/method
And are you using IIS / Apache etc?

I put my assets (css/js/images) in the root folder, where system is.
I've then added lines to my .htaccess file that will ignore rewriting .css/.js/.png|jpg|gif etc files.

If you search the forum you can easily find more info.
#5

[eluser]Rey Philip Regis[/eluser]
Hi,

Actually I have almost the same problem a while ago, cause I have this external CCS file that I want to put in my view. So what I did is that I created a .htaccess file same level with the system folder and index.php

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

and then in my view I added

&lt;link type="text/css" rel="stylesheet" href="&lt;?php echo base_url().'/system/css/default.css'; ?&gt;" /&gt;

so my external CSS file would be available in my view.

And the result.....It WORKS!!!!

Hope that helps.....
#6

[eluser]TVB_FSU[/eluser]
I am using IIS, but in answer to your other question, I must honestly say, I'm not sure. I am using the example from the documentation that has the web root written in the config.sys. I then type something like http://www.website.com/CI/index.php/form. A coworker recommended CI, but he uses Apache, so we've been stumbling through IIS together.

In answer to you, Rev, I think yours is the link I was directed to earlier that I used and received the error. I really wasn't sure where to put the lines or how to reference them, so I'm not surprised I got an error! Smile

I ended up playing with the path on the image, then checking its properties in IE, then playing some more with the code, etc. until I got it right.

Thanks all!

Trish
#7

[eluser]Rey Philip Regis[/eluser]
Haha...Yah trish its my post that you were directed, well I have almost the same problem but mine was CSS not images. The answer to my problem was just the .htaccess file. And it works....Well see yah..

Good day.
#8

[eluser]wr5aw[/eluser]
[quote author="TVB_FSU" date="1225326208"]Now I get the following error: "Fatal error: Call to undefined function site_url() in E:\inetpub\wwwroot\Forms\CI\system\application\config\config.php on line 320"[/quote]
I probably should have mentioned site_url() is from the url helper. That helper has to be loaded, either manually or autoload for site_url() to work.
#9

[eluser]Rey Philip Regis[/eluser]
well in my case i already configured it in the autload onfiguration already. I have problems on that before and I discovered that it must be set or call it manually using load.




Theme © iAndrew 2016 - Forum software by © MyBB