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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 13,308
» Latest member: roll3lg
» Forum threads: 69,238
» Forum posts: 430,592

Full Statistics

Latest Threads
Different timezone betwee...
Forum: CodeIgniter 4 Discussion
9 minutes ago
» Replies: 0   » Views: 1
Advance Tutorials
Forum: CodeIgniter 4 Discussion
18 minutes ago
» Replies: 3   » Views: 85
[feature] Encrypter
Forum: CodeIgniter 4 Roadmap
23 minutes ago
» Replies: 9   » Views: 316
Model for the login, anyb...
Forum: General Help
30 minutes ago
» Replies: 3   » Views: 56
Issues accessing CI forum...
Forum: Lounge
1 hour ago
» Replies: 1   » Views: 20
Duplicate record in postg...
Forum: General Help
4 hours ago
» Replies: 3   » Views: 76
Post's comments
Forum: Best Practices
5 hours ago
» Replies: 3   » Views: 100
Is future CI will impleme...
Forum: Lounge
Yesterday, 06:18 PM
» Replies: 1   » Views: 102
sqlite3 connection
Forum: CodeIgniter 4 Support
Yesterday, 01:35 PM
» Replies: 1   » Views: 56
Dashboard navigation prob...
Forum: General Help
Yesterday, 09:18 AM
» Replies: 1   » Views: 72

 
  Charts in Codignater
Posted by: devapriya - 03-20-2019, 02:49 AM - Forum: General Help - Replies (2)

Hi,

I would like to know which is the best practice to implement charts in CodeIgniter ?


  20.03.19 Message: Object of class stdClass could not be converted to string
Posted by: Porto - 03-20-2019, 02:24 AM - Forum: General Help - Replies (4)

Hello Guys, please i need a Light!

I've already read some cases identical as my issue here in the Forum, but i don't get STILL see what should i do.

The best answer was:
-------------------------------------------------------
eluser]Massaki[/eluser]

The variable $var is an object.

If you want to show an attribute from the object, then

Code:
echo $var->name_of_the_attribute
-------------------------------------------------------

But i still stuck.

I'm using this block of code from the documentation:
https://www.codeigniter.com/user_guide/d...esult-rows

This is my Controller/Method
_____________________________

Code:
        public function votecounting($page = 'vote_detail1')
        {
            if ( ! file_exists(APPPATH.'views/content/'.$page.'.php'))
                {
                       // Whoops, we don't have a page for that!
                       show_404();
                }
        
               $data['title'] = ucfirst($page); // Capitalize the first letter
            $data['totalrows'] = $this->Voting_counter_model->totalparticipants();

            $this->load->view('theme/header');
            $this->load->view('content/vote_detail1', $data);
            $this->load->view('theme/footer');
        }

This is my Model
_____________________________

Code:
    public function totalparticipants()
    {
        $query = $this->db->query("SELECT count(v_id) FROM ci_voting_counter WHERE v_column IN ('A', 'B', 'C', 'D', 'E')");

        $resultrows = $query->row();

        return $resultrows;
    }


This is my VIEW
_____________________________

Code:
  <div class="XXX">
       <span class="current">Votes<strong> <?php print_r($totalrows); ?></strong> </span>
   </div>
   
       <div class="block lrg">
           <div class="title">Vote results</div>
           <div class="info">The number who participated in the Vote yet <strong> <?php echo print_r($totalrows); ?> </strong> VOTER</div>

           <div class="info">The number who participated in the Vote yet <strong> <?php echo $totalrows; ?> </strong> VOTER</div>


If i try to show the variable this way:  <?php echo $totalrows; ?> i got the error message.

Code:
A PHP Error was encountered
Severity: 4096

Message: Object of class stdClass could not be converted to string

Filename: content/vote_detail1.php

Line Number: 24
Backtrace:

File: C:\xampp\htdocs\poll\application\views\content\vote_detail1.php
Line: 24

If i try to show the variable this way:  <?php echo $totalrows->v_id; ?> i got the error message.

Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined property: stdClass::$v_id

Filename: content/vote_detail1.php

Line Number: 24

This is the result of my First print_r() <?php print_r($totalrows); ?>
_____________________________

Code:
Votes stdClass Object ( [count(v_id)] => 498 )

This is the result of my Second print_r() <?php print_r($totalrows); ?>
_____________________________

Code:
The number who participated in the Vote yet stdClass Object ( [count(v_id)] => 498 ) 1 VOTER


What should i do please? v_id is the table_field_id and i just want to show a single row as explained in the documentation.

i've already tried using row_array(), But i stuck the same way.

Thank you so much in advance!


  Queries on Uploading code to Website
Posted by: Sovani Shreeniwas - 03-19-2019, 09:20 PM - Forum: General Help - Replies (6)

I have developed code using CodeIgniter, XAMPP, PHP, HTML, CSS, AJAX, Javascript on a Windows 7 desktop machine. Now, I want to upload to a website. I have below queries, can any one provide information on the same?
1. What changes should I make to the code?
2. Can I buy Linux based Web hosting? In that case what all changes in the code and setup are required? Presently, my development machine is Windows 7 only. Will I need to setup a Linux VM for this purpose and do some specific actions on it?
3. The website is going to be accessed from a windows machine as well as Android TABS - here any specific changes to be made other than updating every view file with - <meta name="viewport" content="width=device-width, initial-scale=1"> (I checked on my windows machine, when browser size is reduced the content gets adjusted to some extent).

Kindly request to suggest on above & also ANY OTHER points which are important.


  Code Modules + Filters + Routes = ERR_TOO_MANY_REDIRECTS. Where am I going wrong?
Posted by: ariom - 03-19-2019, 09:14 PM - Forum: CodeIgniter 4 Support - Replies (4)

Ok here we go. My folder structure looks like this:
   

And before anyone asks, Yes I've added my namespace to app/Config/Autoload.php. That part works fine.

PHP Code:
$psr4 = [
    
'Config'      => APPPATH 'Config',
    
APP_NAMESPACE => APPPATH               // For custom namespace
    
'App'         => APPPATH               // To ensure filters, etc still found,
    
'AriomAuth'   => ROOTPATH 'Ariom/Auth',
]; 

What I want to do is basically roll-my-own auth system. I know there a plenty of choices even at this early stage of the beta, but I figured making my own would help wrap my head around CI4 and namespaces. So far so good.

So the entry point of the app is the Dashboard (app/Controllers/Dashboard.php). On its own, it works fine.
PHP Code:
<?php namespace App\Controllers;

use 
CodeIgniter\Controller;

class 
Dashboard extends Controller {

    public function 
__construct() {

    }
    
    public function 
index() {    
        
helper('html');
        echo 
view('templates/header');
        echo 
view('Dashboard/Dashboard');
        echo 
view('templates/footer');
    }



I've also created a controller and view in my Auth module (Ariom/Auth/Controllers/Auth.php, and Ariom/Auth/Views/Login.php). On their own, they also works fine.
PHP Code:
<?php namespace AriomAuth\Controllers;

use 
CodeIgniter\Controller;

class 
Auth extends Controller {

    public function 
login() {
        echo 
view('AriomAuth\Views\Login');
    }



Where I'm having problems is when it comes to Routes and Filters. I want to redirect the user to login if there is no active session. The way I've seen it come up here in this forum a couple of times is to use a Filter. Ok great, so I've tried to have a go at this.

(Ariom/Auth/Filters/Auth.php)
PHP Code:
<?php namespace AriomAuth\Filters;

use 
CodeIgniter\HTTP\RequestInterface;
use 
CodeIgniter\HTTP\ResponseInterface;
use 
CodeIgniter\Filters\FilterInterface;
use 
Config\Services;

class 
Auth implements FilterInterface
{
 
   public function before(RequestInterface $request) {
 
       $session Services::session();
    if(!
$session->has('authenticated')) {
        return 
redirect('login');
    }
 
   }

 
   public function after(RequestInterface $requestResponseInterface $response {
 
       
    
}

(app/Config/Filters.php)
PHP Code:
//--code--

public $aliases = [
    
'csrf'     => \CodeIgniter\Filters\CSRF::class,
    
'toolbar'  => \CodeIgniter\Filters\DebugToolbar::class,
    
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
    
'auth'     => \AriomAuth\Filters\Auth::class,
];


public 
$globals = [
    
'before' => [
        
//'honeypot'
        // 'csrf',
        
'auth',
    ],
    
'after'  => [
        
'toolbar',
        
//'honeypot'
    
],
];
//--endcode-- 

(Ariom/Auth/Config/Routes.php)
PHP Code:
<?php namespace AriomAuth\Config;
$routes->add('login''AriomAuth\Controllers\Auth::login'); 

So what I know is this:
  • the filter does run
  • the session is checked and correctly runs the redirect when no session variables are found
  • the redirect is triggered and loads the custom route
All good so far. BUT...

Although I do get redirected to /login, I time out with ERR_TOO_MANY_REDIRECTS. I have no idea where to begin debugging this. Any ideas, anyone?


  Third Party Migrations
Posted by: MGatner - 03-19-2019, 02:15 PM - Forum: CodeIgniter 4 Support - Replies (11)

I'm working on a library whose goal is to be plug-and-play, zero conf, whatever you want to call it. CI4 has made this *great* with name spacing everything and PSR4 autoload. My question is about the best practice around database migrations/seeds that come with a library.
The typical way I'd handle a table would be to create the migration and run it from CLI. However, CI4 has the ability to run migrations from a controller or library (https://codeigniter4.github.io/CodeIgnit...ge-example), which makes it appealing to offer "automatic database configuration" - maybe the constructor checks for the existence of the table and runs the migrations if not found.

How do autoloaded Composer packages typically handled migrations? is there an expectation that the user will run it from CLI - every time there's an update / new migration? Can a package pass its own [namespace]/Config/Migrations.php and load it to the migrations service? if so is it customary to use the default "migrations" table? Anyone with experience in the area care to weigh in?


  Cron job returns "Undefined index: REQUEST_METHOD"
Posted by: anturom - 03-19-2019, 01:35 PM - Forum: General Help - Replies (8)

Hi,

I'm attempting to run a cron job using CodeIgniter 3.1.8. The cron job works fine locally from the Windows command line, but when I run it on a Linux server as a CPanel cron, I get this in the output (among various other session related warnings):

<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message:  Undefined index: REQUEST_METHOD</p>
<p>Filename: core/Security.php</p>
<p>Line Number: 211</p>

Would be grateful for any help...


  Basic App - Free CMS on CodeIgniter 4
Posted by: Basic App - 03-19-2019, 11:19 AM - Forum: CodeIgniter 4 Addins - Replies (7)

We are pleased to inform you about the release of the public version of the Basic App. The first version of the system implements the management of text pages and a simple blog. In the Basic App, the Cool Admin theme is integrated into site backend, and the public part is done with the Clean Blog theme. Themes in the system are placed in external Composer packages, you can easily change the design of the entire site without interfering with the system code. The system is made extensible, the classes in the system modules use the object-oriented programming inheritance, you can easily extend them with new functions.

[Image: screen_pages.png?raw=true]

The Basic App aims to be a reliable foundation for your CodeIgniter 4 based site. The system implements management of administrators, management of access roles to different backend area sections, storing of configs in database and management of them from backend. The Basic App has management of the templates of e-mail messages sent from the site, management of SMTP server settings from the backend, management of the site menus. The PHPMailer package is integrated to send messages from site.

Basic App GUI is multilingual, you can manage translations of the backend area interface through the web interface in the backend.

Client scripts are managed through Bower, the basic version is configured to edit the text of the pages through the visual editor TinyMCE, the editing of site layout blocks is done with code highlighting through CodeMirror, the text of blog posts is edited using Markdown markup. You can change these editors to any others you are used to using.

  - Installation Instruction
  - Documentation

The system is distributed under the MIT licence, you can freely use it to create your own websites, including selling them to third parties, while maintaining the copyrights of the Basic App in the backend and in the code of the modules of system.

We are waiting for a backlash from you, your advice will help us to make the system better together.


PS: Basic App Dev Team offers services for creating websites on the Basic App, integrating ready-made themes, and developing additional modules for the Basic App.


  CI-Breadcrumb
Posted by: ecampait - 03-19-2019, 05:33 AM - Forum: Addins - No Replies

Hi,

I propose this library for CodeIgniter 3.x.x, CI-Breadcrumb. This one allows to create a menu of navigation of the type "breadcrumb".

Source: https://github.com/domProjects/CI-Breadcrumb

[Image: screenshot.png]


Brick block mapping sequence [CI2]
Posted by: cruiser - 03-19-2019, 02:28 AM - Forum: General Help - No Replies

I am using HMVC and on some pages there is a problem with the sequence of displaying blocks. At the beginning of my view I call
<? = modules :: run ('header')?>
Next comes the HTML code of my page. The problem is that the header code can appear anywhere, in the middle or at the end of my view. I can not find the reason for this, although the time for calling each module is correct.


  session lock feedback
Posted by: makif - 03-19-2019, 01:23 AM - Forum: Libraries & Helpers - Replies (3)

hi everyone
i want to give feedback when query takes long and user session locked, i mean like "you should wait until query ends"  i have tried but no results for me 
i have get_lock function in those pages

  • Session_database_driver.php 
  • Session_memcached_driver.php
  • session_redis_driver.php
  • Session_driver.php
i have tried which function works when session locks but i dont find.
i guess "SELECT GET_LOCK('".$arg."', 300) AS ci_session_lock")->row()->ci_session_lock" is locked my session but i did comment that line nothing is affected
thanks for suggestions



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