Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 15,889
» Latest member: henryjones147
» Forum threads: 70,671
» Forum posts: 363,552

Full Statistics

Latest Threads
Integrating relationship ...
Forum: CodeIgniter 4 Feature Requests
15 minutes ago
» Replies: 13   » Views: 2,429
CI4 and Myth Auth
Forum: CodeIgniter 4 Support
24 minutes ago
» Replies: 3   » Views: 313
Developer Needed
Forum: Jobs
24 minutes ago
» Replies: 4   » Views: 162
Debug Toolbar above of th...
Forum: CodeIgniter 4 Discussion
25 minutes ago
» Replies: 3   » Views: 93
Relations Module
Forum: CodeIgniter 4 Addins
39 minutes ago
» Replies: 6   » Views: 1,036
CodeIgniter 4.0.0-rc.4
Forum: News & Discussion
2 hours ago
» Replies: 26   » Views: 7,470
How to make column filled...
Forum: General Help
2 hours ago
» Replies: 1   » Views: 30
Metallo.id - A Multi-purp...
Forum: Spotlight
6 hours ago
» Replies: 5   » Views: 1,511
How To Clear The Cache On...
Forum: General Help
Yesterday, 04:42 PM
» Replies: 4   » Views: 341
Session Library differenc...
Forum: CodeIgniter 4 Support
Yesterday, 04:32 PM
» Replies: 5   » Views: 157

 
  Not always showing 404_error custom page
Posted by: guerreroretirado - 02-06-2020, 02:14 PM - Forum: Installation & Setup - Replies (1)

Hi, 

I have been working with CI for just few weeks, and am still discovering and learning new things about it. Today I have faced an issue and although I have done some reasearch, I am not able to solve it. 

The thing is that I am running codeigniter (version 3) in localhost. And I am trying to customize the 404 error page. To do so, after following some tutorials out there, I did the following changes. 

First, I have created a CONTROLLER (Not_found.php): 

PHP Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class 
Not_found extends CI_Controller {
  
  
public function __construct() {
    parent::__construct();
  }
  
  
public function index() {
    $this->output->set_status_header('404');
    
    $this
->load->view('templates/header');
    $this->load->view('pages/404');
    $this->load->view('templates/footer');
  }


Then, I have generated the view, that can be found under: views/pages/404.php. 

To finish the job, I have modified the ROUTING adapting the file /config/routes.php as follows: 
PHP Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

$route['content/(:any)'] = 'content/view/$1';
$route['wishlist'] = 'wishlist/view';
$route['admin'] = 'admin/view';

$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';
$route['404_override'] = 'not_found';
$route['translate_uri_dashes'] = FALSE

Now, what happens is this. If I try to access an url that does not exist (for example: /localhost/this-does-not-exist), it shows the CI standard 404 error page. But, if I try to access any other random url containing a folder, then it works fine (for example: /localhost/folder/this-does-not-exist). 

Also, if I try to access urls under the content folder, they also show the CI standard 404 error page. So I guess that the problem is regarding the (:any) in the routes. But I am not able to find a solution to this while keeping both functionalities working together. 

What are your thoughts on this?

Thank you so much!
Regards Smile


  CI4 controller can't 'see' a GET parameter
Posted by: Ged - 02-06-2020, 11:26 AM - Forum: General Help - Replies (5)

the form:

Code:
<form action="/news/create">

    <label for="title">Title</label>
    <input type="input" name="title" /><br />

the link:

https://df2.pennyjack.co.uk/news/create?...+news+item
[url=https://df2.pennyjack.co.uk/news/create?title=test+title&body=this+is+a+test+body&submit=Create+news+item][/url]
the check code:

PHP Code:
public function create()
 {
helper('form');
$model = new NewsModel();

var_dump($this->request->getVar('body'));
echo 
'<br>';
var_dump($this->request->getVar('title'));

//die(); 

the result:


PHP Code:
string(19"this is a test body"

NULL 


It can see the body but not the title.  Any idea?

Thank you


  Question: PHP 7.4 with Preloading in CI 2/3 possible?
Posted by: thesuit - 02-06-2020, 05:37 AM - Forum: Lounge - Replies (3)

Hello,

Curious if anyone is running PHP 7.4 on CI2 or CI3 and/or with preloading and can comment if this is expected to work.

Thanks!


  Change the backgroundcolor when upload an png image
Posted by: fueldesignPT - 02-06-2020, 05:15 AM - Forum: CodeIgniter 3.x - Replies (1)

Hi everyone,

Is any way to change the background color when i upload an png file with transparent background...

As default th ci put the black background on image... I want the white image...

Thanks a lot.


Sad Question about $route['some']
Posted by: Francisco Maneiro - 02-05-2020, 09:11 PM - Forum: General Help - Replies (1)

Hello, here i am whit some problem whit my route configuration, i am in some trouble making a new $route parameter. i dont know what i doing wrong because i make too much other routes and it work fine.


This route whenever i use give a 404 error. even when the index function or whatever other function i use exist. i dont know if there is a limit whit the routes. i will apreciated any help u can give for this problem.  Huh Sad


PHP Code:
$route['blog/buscar(.+)'] = "Blog"






there i goin to leave every other route i use



PHP Code:
$route['categoria-(.+)/(.+)'] = 'Categorias/categoria_spec';
$route['categoria-(.+)'] = 'Categorias/categoria_spec';
$route['especial-(.+)'] = 'Especial';
$route['oferta/(:any)'] = 'Productos';
$route['empresa/(:any)'] = 'Empresas/by_empresas';
$route['buscador(:any)'] = 'Buscador';
$route['registrar'] = "Usuario/registrar";
$route['validar-cuenta'] = "Usuario/validar";
$route['recuperar-cuenta'] = "Usuario/recuperar";
$route['validar?(:any)'] = "Usuario/validar_hash_view";
$route['recuperar-cuent?(:any)'] = "Usuario/recuperar_hash_view";
$route['usuarios/datos'] = "Usuario/miCuenta";
$route['usuarios/compras'] = "Usuario/compras";
$route['usuarios/compra/(:any)'] = "Usuario/comprasDetalle/$1";
$route['usuarios/cupones'] = "Usuario/cupones";
$route['usuarios/cupon/(:any)/(:any)/(:any)'] = "Usuario/cupon/$1/$1/$1";
$route['usuarios/imprimir/(:any)/(:any)/(:any)'] = "Usuario/get_pdf/$1/$1/$1";
$route['blog/buscar(.+)'] = "Blog"//there is the one
$route['blog'] = "Blog/blog";
$route['blog/c-(.+)'] = "Blog/categoria_blog";
$route['blog/c-(.+)/(.+)'] = "Blog/categoria_blog";
$route['blog/(:any)'] = "Blog/single";
$route['comprar'] = "CarroCompra/carroCompra";
$route['checkout'] = "CarroCompra/waiting_compra";
$route['sobre-nosotros'] = "Extras/nosotros";
$route['como-funciona'] = "Extras/nosotros";
$route['libro-de-reclamaciones'] = "Extras/reclamaciones";
$route['terminos-y-condiciones'] = "Extras/nosotros";
$route['politicas-de-devolucion-y-garantia'] = "Extras/nosotros";
$route['contacto'] = "Extras/contacto"


  Error when adding a datepicker
Posted by: Mekaboo - 02-05-2020, 09:15 AM - Forum: General Help - Replies (1)

Hello all!!

Im trying to add a datepicker but came into an error....wanted to see if anyone can can help. Here is the code:

Error:
A PHP Error was encountered

Severity: Notice
Message: Trying to get property of non-object
Filename: register/index.php
Line Number: 29
Backtrace:
File: /home4/cultured/public_html/application/views/register/index.php
Line: 29
Function: _error_handler
File: /home4/cultured/public_html/application/libraries/Template.php
Line: 33
Function: view
File: /home4/cultured/public_html/application/controllers/Register.php
Line: 356
Function: loadContent
File: /home4/cultured/public_html/index.php
Line: 318
Function: require_once
12/31/1969">


Code:
<div class="form-group login-form-area has-feedback">
                    <input type="text" class="form-control" name="username" id="username" placeholder="<?php echo lang("ctn_215") ?>" value="<?php if(isset($username)) echo $username; ?>">
                    <i class="glyphicon glyphicon-user form-control-feedback login-icon-color" id="login-icon-username"></i>
                </div>
                  <div class="form-group" id="relationship_part">
        <label for="inputEmail3" class="col-sm-2 control-label">Birthdate</label>
        <div class="col-sm-10">
          <input type="text" name="birthdate" class="form-control datepicker" value="<?php echo date($this->settings->info->date_format, $this->user->info->birthdate) ?>">
        </div>
             

 Im trying to make the "relationship" form group to resemble the "login" form group but cant get it right. I purchased the script and the seller has been helpful but I haven't heard from them in regards to fixing this code.


Thank ya so very much!!


Heart Heart ,
Mekaboo


  Error database
Posted by: osvaldobnu - 02-05-2020, 07:02 AM - Forum: Installation & Setup - Replies (3)

Hey everyone, 

I'm pass for a strange situation,

I'm developing a web system and in my localhost works fine, but I just put the site in the cloud,
So I fix the database infos, and all my model class, to first letter UPPER, but when I will login on system, sometimes works fine, but some times get an error, that I will post a image of error and my source code, is that, sometimes works login some times no, I searched a lot and can fix Sad

Anyone can help?



Attached Files Thumbnail(s)
       

  Creating a custom service/library
Posted by: Fido L Dido - 02-05-2020, 06:37 AM - Forum: CodeIgniter 4 Support - Replies (5)

Hi there,

I'm a newbie to CI4 so please bear with me. I'm building a small project and am keen on keeping my controllers small so intend to carry out input validation within my project's models.

It has been suggested that it may be good practice to pass back the result from a model's method (such as 'create') as some sort of result object. This object would contain fields to indicate whether the method failed or succeeded and could also contain an array of fields that did not validate, along with user-friendly error messages, etc, etc.

I think this sounds like a good idea. So my understanding is that each model should really tie to a field in the database so I shouldn't be creating a new result model. Instead it looks like I should be creating a result service and passing it into a model's method as a dependency.

I've read the CI4 documentation on creating services and could do with a little bit of guidance by way of an example. Or, tell me this is the wrong way of doing this.

Any help or pointers would be greatly appreciated.


  Ci 3 $_POST not accepting spaces?
Posted by: sanderv - 02-05-2020, 03:17 AM - Forum: General Help - Replies (4)

Hi All, 
I am building a car dealer app for a friend using Ci 3 and HMVC.
from the database i am querying a set of car options, that get listed in a view file as checkboxes. 
in the controller :

PHP Code:
function list_options(){

$mysql_query "SELECT t1.option_name
     , t2.id
     , t2.parent_name 
  FROM option_children AS t1
LEFT OUTER JOIN option_parents AS t2
    ON t2.id = t1.parent_id"
;
$query $this->_custom_query($mysql_query);
$result $query->result();

var_dump($result); die();

foreach(
$result as $row){

 
$groupedData[$row->parent_name][] = $row->option_name;
 }
 return 
$groupedData;




and displayed in a form like this :

PHP Code:
foreach ($caroptions as $key => $value) {
   echo '<dl style="margin-bottom: 1em;">';
 echo 
"<dt>$key</dt>";
 foreach (
$value as $row ) {
  ?>
 <div class="checkbox">
    <label>
      <input name="options[<?= $row ?>]" value ="1" type="checkbox">
      
      <?=  $row ?>
    </label>
  </div> 
<?php }
?>
 </dl>
<?php



so far so good, but when i actually select some of the checkboxes and submit the form , data gets collected like this :

PHP Code:
$data["optionsarray"] = $this->input->post('options[]'TRUE); 


Now, when the key contains spaces, this does not work and an empty key is returned. like ["0"] => string(1)"1"  for example if i select an option called:
2 door , then the key will not be [2 door] but it will be empty. Same goes for when i use 2 words seperated by a space like " heated seats" 

if i use words that have no spaces like "ABS" or "airconditioning"  then the key is set and will return  ["ABS"]=> string(1) "1"

When i recreate the above scenaria in plain PHP, it works without errors.  
i have no idea why this is not working in codeigniter?  anyone any idea?


  Help me with route, thanks
Posted by: mjamilasfihani - 02-04-2020, 09:14 PM - Forum: CodeIgniter 4 Support - Replies (5)

I use my codeigniter rc3 as HMVC. Here is my structure

[Image: 73802195-755ce700-47ef-11ea-8a2a-cf88cd83dd12.png]

I try to do some action from HomeView with input username and password also method POST that handled by Home Controller to ActionSignIn. I set the route like this

PHP Code:
$routes->get('action-signin''Acme\Home\Controllers\HomeAction\ActionSignIn::index'); 

Peekaboo, it show 404 when I press the submit button. I try to visit

Code:
https://my.project-name.tld/action-signin

directly, nothing was wrong.



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.