![]() |
How to buildt dinamicly a controller? - 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: How to buildt dinamicly a controller? (/showthread.php?tid=7136) |
How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]Peter74[/eluser] Hi all, iam building a site where the customers can show them products, i whish to show a url like this www.thedomain/customersite1 to www.thedomain/customersiteN but not from code (i hope a lot of customers suscriptions xD), i dont know if iam thinking the good way, maybe u can help with something to start. Very txs in advance ----- sry about my poor inglish How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]gon[/eluser] I don't know how you could do that, but you could have a common controller: www.thedomain/customersite/N and catch the argument passed (N). Then you can instantiate a class that uses the argument for its name, and use it as a "controller". Not a real one, as you would have to call its methods manually. just being curious: Why do you need to create the constructor on the fly? How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]Peter74[/eluser] Hi, txs for reply I wanna create a page and a url for a new customers whitout the code. example 3 new customers and them urls the visitors go to the www.thedomain/suscribe and then lauch a controller than can create that above www.thedomain/cocacola www.thedomain/pepsi www.thedomain/gatorate iwas thinking in have one (a base controller)for that and then copy it(create a new file called "cocaloca" or whetever customer name be) finally i wanna have something like this controllers ---controllerssite ------suscriptions ------somothingmore ---cocacola ------images ------css ---pepsi ------images ------css ---gatorate ------images ------css .. N i wanna provide for the costumers his own url (thedomain/cocacola) that why i need a new controller for each costumer txs for read How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]gon[/eluser] You can store customer names and their ids into the database. Then, if someone hits: domain.com/cocacola You can get the argument (the string "cocacola") and search for its id. And do whatever you would do with it. IMHO, copying a file at the server before executing it is a very bad idea. For what you are doing, you dont need that level of complexity. And for CSS and imgs, I don't see any problem in doing what you say. You just have to make their urls dynamic. How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]Peter74[/eluser] ok i get it but ... how i can put the string in the url line? www.thedomain.com/cocacola ? how i can put that cocacola string there? i wanna provide his own url (for bussines card or something) i know i can search the string in that way, but i need put his name there pd: what that mean IMHO ? How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]gon[/eluser] You build the link URLs at the views, dont you? http://en.wiktionary.org/wiki/IMHO How to buildt dinamicly a controller? - El Forum - 03-26-2008 [eluser]Peter74[/eluser] yes sr, finally get it. Very txs for ur help ![]() |