few questions form rookie |
[eluser]Przemek[/eluser]
Hi, I'm new in codeIgniter and i have few questions abut scaffolding, and load views. 1) scaffolding can I pre per few scaffolding to work in one website ? like: Code: $route['scaffolding_trigger'] = "laduj"; Code: $this->load->scaffolding('news'); 2) is its possible to load into one view multiple variables ? like Code: $data['query']=$this->db->get('news'); thanks in advance
[eluser]pistolPete[/eluser]
Quote:1) scaffolding can I pre per few scaffolding to work in one website ? This is not possible since you overwrite the first trigger whith the second one. Please be aware of the following: User guide Quote:Scaffolding has been deprecated from CodeIgniter as of 1.6.0.I'd rather write some own controllers/functions in order to gain the needed flexibility. Quote:2) is its possible to load into one view multiple variables ? Of course, just put them all in one associative array. Read the user guide: http://ellislab.com/codeigniter/user-gui...views.html
[eluser]jedd[/eluser]
Hi Przemek and welcome to the CI forums. Scaffolding ... is pretty much deprecated now, and wasn't ever hugely encouraged by the sounds of it , so you're better off finding an alternative. Two paths you can take - something like phpmyadmin (web front end) which seems very popular around here, or (my preference) writing up your schema and insert data into a bunch of text files. I like the latter approach because you can engineer your test data sensibly, and easily re-create your base set of data with one or two 'source' commands. Multiple data to a view Instead of doing this: Quote:2) is its possible to load into one view multiple variables ? like ... try this: Code: $data['news']=$this->db->get('news'); In your view you'll have $news (your query results) and $glowne (your array). Quote:and also is it possible to have a default loading variables ?? Yes, but you'd need to describe what by you mean a bit better. If you have just one or two variables that you want to set, try config/config.php If something larger, with perhaps some logic wrapped around them, there's several places.
[eluser]Przemek[/eluser]
Thanks i used $data as one array it works very well. About scaffolding, i will need to write other admin sub page to manage that. Thanks for info. ps. about that deflaut I have code like that Code: function nowosci() and as you might see i write 2 times Code: $data['glowne']=array("nowosci"=>'Nowości',"sklad"=>'Skład',"tabela"=>'Tabela'); like Code: class drozyna extends Controller {
[eluser]Przemek[/eluser]
Also you spook about security. I want create admin panel tell me plz am i right. I create function in my controller Code: function admin() its loading a file when i prompt password, next is loaded second page from function Code: function admin_loguj() is it ok or code igniter have some build in admin function
[eluser]jedd[/eluser]
Reducing repetition Yup, you can put it in your constructor, which is the logical place if you're using this array in one controller only. If you're using it in more than one controller(?), then there are better places. So you'd have: Code: class drozyna extends Controller { In your methods, you'd then use $this->data rather than $data -- read up on variable scope on the PHP web site, as this is an important distinction to understand.
[eluser]jedd[/eluser]
[quote author="Przemek" date="1250703388"] were i check that password and create new one witch is passed as array to file admin_loguj there i check $pass and if its ok its load and there i have all admin content is it ok or code igniter have some build in admin function[/quote] Wow. Uhm, CI has no built-in admin or auth function - a topic of discussion that comes up regularly around here. You may want to check out [url="https://github.com/jedd/User-Library"]thody's User-Library[/url] if you're after a basic system you're happy to hack. As far as I can tell, though, your authorisation process here is simply to check if the password has been supplied on the URL, is that right? Do you have a user table in your database already?
[eluser]Przemek[/eluser]
Well... It will be only administration of content no user controll so no database conection there. There will be form were you input password witch is cheked in controller, then will be load admin page witch password protected that is add on web page Code: function admin_loguj() Code: if($pass==qwer){ |
Welcome Guest, Not a member yet? Register Sign In |