Welcome Guest, Not a member yet? Register   Sign In
Two beginner questions
#1

[eluser]Unknown[/eluser]
Hello CodeIgniter Community,

As a beginning CodeIgniter (and "MVC concept") user I run into a couple of problems with my application.
The idea behind this application is to create a place for my client to manage his website news in all languages in a simpler way than the one provided by his CMS. Hereto I have created some pages, an index, a new and an edit page, with corresponding controllers and models.

The problem: repopulating the fields.

Normally I use the set_value() function for this, combined with the form_validation class. On this occasion though, none of the fields is required. So why would I want to repopulate it? Because there is an "file" input field in the form where an image can be uplaoded (in both new and edit pages). This can go wrong, e.g. user could upload a too large file, wrong file extension...

How could I get set_value to work when not using the form_validation class?

The second problem involves the other CMS (CMS Made Simple). I want to include something in the template in order to show the news, normally you would just include {news) but since I want to use the DB from the CodeIgniter app that will not work. So, what is a logical/correct way of including a CodeIgniter page (http://www.example.com/newsapp/index.php/news/show_fr) into a page such as http://www.example/com/home.html ?

Thanks in advance for help!!
#2

[eluser]Mr. Pickle[/eluser]
You can still use the Validation class but actually don't put any rule.
This will keep the set_value() still working.

So for example:

view file:
Code:
<input type="text" name="test" value="<?php echo set_value('test');?>" />;

controller file:
Code:
$this->form_validation->set_rules('test', '');
#3

[eluser]Aken[/eluser]
set_value() works fine without the form validation class. Look at the source code.




Theme © iAndrew 2016 - Forum software by © MyBB