codeigniter

How to get the class from which a request originates in codeigniter

五迷三道 提交于 2020-01-25 00:18:45
问题 My modules all extend Backend controller which checks if loggedin and redirects appropriately, now I have Class FrontEnd [responsible for pages like login, signup etc] which extends My_Controller. how can I create an exemption for FrontEnd to be able to access the modules since it needs their methods to perform tasks. this is what I have currently .... class Backend_Controller extends MY_Controller { // -------------------------------------------------------------------------- public function

Relational databases and CodeIgniter

北城以北 提交于 2020-01-25 00:13:08
问题 I'm using CodeIgniter to build a website, and I want to show a list of construction projects from a database table, which we will simply call project_table . For each project I also have an address, stored in another table, address_table , each address has a project_id , which links it to a project. I have made a function, get_projects, in my projects model, which is used to get the project information and pass it to the project view, like such: public function index() { $data['projects'] =

CSS wont trigger in live production with CodeIgniter framework

爱⌒轻易说出口 提交于 2020-01-24 22:42:08
问题 I'm having an issue with my project. It has no errors and something but when I tried to upload it on some free hosting sites The CSS wont trigger. This is my first time uploading my project so guys this the url grandluis.epizy.com/grand/ or https://grandluis.000webhostapp.com and my directory was like this. /htdocs- -------/grand- -------------/application- -------------/assets- -------------/system- -------------.editorconfig -------------.htaccess -------------.composer.json -------------

How to create sitemap for static and dynamic pages

那年仲夏 提交于 2020-01-24 22:18:04
问题 I have created website using the CI framework 3.0 and still i am stuck in creating the xml sitemap for static and dynamic pages. 回答1: Your question is very clear. i'm using codeigniter with the sitemap php Library. Its awesome and has clear directions: https://github.com/evert/sitemap-php To get you started - Put the SitemapPHP folder in application/libraries Then, in your controller, in your method you call the library like: public function makeSitemap() { // APPPATH will automatically

Codeigniter form validation

和自甴很熟 提交于 2020-01-24 21:35:13
问题 Can I display a single message for the multiple form fields in CodeIgniter? For example, I have set following rules for the email and password fields. I want to display only one message if any of these two fields is invalid. (eg. invalid email or password ") $this->form_validation->set_rules('email_address', 'Email Address', 'valid_email|required'); $this->form_validation->set_rules('password', 'Password', 'required|min_length[4]'); How i can do that? Thanks for any help. Edit: Sorry if my

Pagination Last link disappeard after page 10

蹲街弑〆低调 提交于 2020-01-24 21:24:04
问题 I make a pagination with Pagination Class of CodeIgniter and some tutorials, it work fine, but the problem is that after the page number 10 do not show the Last Page link. My controller $select_per_page = 5; if ($this->session->userdata('cantidad')) { $select_per_page = $this->session->userdata('cantidad'); } $obj = new General(); // (BEGIN) Pagination// $config['base_url'] = base_url('test/Gestionar_Test/'); $config['per_page'] = $select_per_page; $config['num_links'] = 4; $config["total

Php fiscal year report, trouble with selecting proper year

风流意气都作罢 提交于 2020-01-24 21:17:26
问题 I am building a report for a client using php and codeigniter. This report is a financial report, as such, I must reflect money collected since the beginning of the fiscal year. In this case, July 31st. I already query the user for the date of the report, but how would I get php to know which fiscal year to take? I have a rough idea, something along the lines of 'If Month-Day is before July 31, use current year-1 Else use current year' But I do not know how I would code that, or if it would

Codeigniter error: The filetype you are attempting to upload is not allowed

末鹿安然 提交于 2020-01-24 17:53:05
问题 If I upload a csv file, there is no problem on localhost and everything works fine, but when I upload my app on live server and upload a csv file then this error thrown: The filetype you are attempting to upload is not allowed. I am confused as to why this happens. Please help me to solve this. For my localhost environment, I am using XAMPP and CodeIgniter. I only want to allow csv file uploads. 回答1: check 2 things: First: in your upload controller: make sure to set the correct allowed types

Message: mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known

帅比萌擦擦* 提交于 2020-01-24 17:39:08
问题 I am new to PHP MVC CI and I am getting below error. Message: mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. Below is my info being passed. hostname:http://localhost:1234/Sample/ username:root password: //here Password is blank database:codeignitordb port:1234 Function $mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags); here $socket and $client_flags are Null Question: Am I missing

mysql | Codeigniter Active Records are adding extra back ticks to query

纵饮孤独 提交于 2020-01-24 12:53:48
问题 When i try to run query in through codeigniter active records i get error as it is adding extra `` This is the query the codeigniter is trying to execute SELECT `T`.`id` AS TimeSheetID, DATE_FORMAT(T.date_created, `'%M')` AS MonthName FROM (`timesheet` T) but this is the query that i actually want to execute. SELECT `T`.`id` AS TimeSheetID, DATE_FORMAT(T.date_created, '%M') AS MonthName FROM (`timesheet` T) how can i escape the extra colons added by the active records.. how can i write this