Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all 14343 articles
Browse latest View live

[feature] Email

$
0
0
The Email feature has not made it into the distributable CodeIgniter 4 yet. The Email class from CI3 did not port gracefully to CI4, and has been redesigned CI4-style. Implementation & testing are under way.

We held a subforum poll earlier, to see which of the email protocols the community uses, and the answer was all three: mail, sendmail and SMTP.

Planned so far:
[x] separate Email\Email class, which encapsulates an Email entity
[x] Email\TransporterInterface, which abstracts the behavior of a mail transport agent, or a wrapper for same, or even an external email service
[.] Email\Handlers\BaseHandler, which implements the common methods of a Transporter
[.] Email\Handlers\MailHandler, which uses (PHP)mail to send emails; was in CI3
[.] Email\Handlers\SendmailHandler, which uses sendmail to send emails; was in CI3
[.] Email\Handlers\SMTPHandler, which uses SMTP to send emails; was in CI3
[.] revised user guide writeup for handling email
[x] unit testing for Email\Email
[.] unit testing for Email\Handlers\...
[ ] using an external email testing service for unit testing; leaning towads https://mailcatcher.me/


This thread includes a poll, to ascertain the importance of other possible email adapters that might be reasonable to provide.
----------------------------------------------------
This is a roadmap feature, or "epic", and a card on the roadmap board.
Component tasks will show up as issues or PRs on the development board.
We welcome comments & suggestions below.

CodeIgniter problem after upload to hosting

$
0
0
Hello! I have problem with CodeIgniter!

When i launch server on XAMPP everything is working good:

BD (bangladesh)

Database query in a controller method?

$
0
0
Every now and then I need to run a quick database query which doesn't really belong to any of the Models. Or even when setting a quick demo site, I need a quick and dirty way. In CI3, I could just do
Code:
$this->db->query();
Is there something like that available in CI4?

I thought of setting a private variable as below and then use it in any of the methods. I am wondering if there is any better way?

PHP Code:
class Home extends Controller
{
 private 
$db;
 
   public function __construct()
 
   {
 
       $this->db = \Config\Database::connect();
 
   }

 
   public function index()
 {
 
$query $this->db->query('SELECT name, title, email FROM my_table');
 
//process query info
 
 
return view('welcome_message');
 }


LightORM

PHP 7.3.3 Has been released

Using xml files for a web project.

$
0
0
The main question here is the following,
"Is it safe - ok - faster - lighter for the website (call it as you wish) to use an XML from server file or url directly and not storing them in the db, in order to get website entries?"

E.g.:
Let's say we have a website with multiple users in it and some of them having some blog posts. Is it ok and the most important, safe to use an XML to parse the data?


P.S.: I couldn't find any related subjects about this so i thought that it would be a good discussion subject for some newbies (like me Tongue Tongue Big Grin )
Thanks!

CI4 beta.1 - How to load view in view with layout

$
0
0
Hello,

In beta 1, how can I load a partial view in a view with layout?

When I use this code, nothing is rendered. 
PHP Code:
<?= $this->extend('layout'?>

<?= $this->section('content'?>
    <?= view('partial'); ?>
    <h1>Hello World!</h1>
<?= $this->endSection() ?>


But without layout, it will work.
PHP Code:
<?= view('partial'); ?>
<h1>Hello World!</h1> 

How to make projiects?

$
0
0
Hi every one, i need your help. I have completed responsive design projects but after it i didn’t motivate myself to do other projects.I ended up with many tutorials on different sites but it didn’t help me to get good knowledge of practical purposes.how can i do that? pls

Link Relationships in Codeigniter

$
0
0
i work on open source LMS , in URL 
Code:
https://localhost/lms/course/1
 when i log into this course , i have sections and content , here is Udemy Course https://ibb.co/gyfd8yG , i want to do the same thing in my project, here is my query

PHP Code:
public function get_course_data($id)
 
   {
 
       $this->db->select('*');
 
       $this->db->from('courses');
 
       $this->db->join('sections','sections.section_course =courses.course_id ');
 
       $this->db->join('contents','contents.section_num = sections.section_id');
 
       $this->db->where('course_id',$id);
 
       $this->db->order_by('section_num','ASC');
 
       return $this->db->get()->result_array();
 
   

when i do foreach in frontend this query print all queries , my question is how i can specify to print All Contents who linked to the same section id, what is the logical way ?
thanks in advance.


[feature] Message queue

$
0
0
The Message Queue feature has not made it into CodeIgniter 4 yet, but is planned. Initial work began a couple of years ago, but stalled. The current implementation direction provides for a queue backed by a database, or integrated with RabbitMQ.

This thread includes a poll, to ascertain the importance of external message queue services that are important to the community, might be reasonable to provide adapters for. Feel free to suggest others in posts in this thread.

Planned so far:
[.] Queue\Queue
[.] Queue\QueueInterface
[ ] Queue\Exceptions\QueueException
[ ] Queue\Handlers\BaseHandler
[.] Queue\Handlers\DatabaseHandler
[.] Queue\Handlers\RabbitMWHandler
[.] App\Config\Queue
[ ] unit testing for the above
[ ] user guide section for the above

----------------------------------------------------
This is a roadmap feature, or "epic", and a card on the roadmap board.
Component tasks will show up as issues or PRs on the development board.
We welcome comments & suggestions below.

[feature] Database Handlers

$
0
0
Extensive database abstraction & support are built into CodeIgniter 4. The initial release supports MySQL/MariaDB, Postgres, and SQLLite. Support for other databases has been requested, but there hasn't been an outpouring of offers to help. We will slowly get to these, at least those we are familiar with, in due time.

Help provide direction to the team, by using the poll to let us know which databases are important to have handlers for. Feel free to suggest others in posts in this thread.

Database handlers current or planned:
[X] MySQL
[X] Postgres
[X] SQLLite3
[ ] What should go here?

----------------------------------------------------
This is a roadmap feature, or "epic", and a card on the roadmap board.
Component tasks will show up as issues or PRs on the development board.
We welcome comments & suggestions below.

[feature] Encrypter

$
0
0
CodeIgniter 3 has an Encryption class. This was re-architected for CodeIgniter 4, as a service and with handlers. When the dust settled, we ended up with handlers for OpenSSL & Sodium. The Sodium handler, to remain simple & elegant, needed PHP7.2 and CI4 was based on 7.0 or 7.1 at the time.

In the fall of 2018, we decided to not include our encryption module in CI4, and instead have directed developers to HALite.

Now that CI4 is built on PHP7.2, the question then comes up again ... should we include a simple encryption module in CI4?
What is built, and ready to roll, has a very simple interface:

Code:
interface EncrypterInterface
{
    public function encrypt($data, $params = null);
    public function decrypt($data, $params = null);
}

Parameters include the cipher, digest and encoding to use.

Let us know if you think this belongs in the core, using the poll.
If so, are there other encryption-related features that should be part of the module, such as digital-signing?

----------------------------------------------------
This is a roadmap feature, or "epic", and a card on the roadmap board.
Component tasks will show up as issues or PRs on the development board.
We welcome comments & suggestions below.

Correct permissions for Writable folder?

$
0
0
Could somebody show me what permissions do I need to setup for Writable and it's sub folders?

I am getting this error

CodeIgniter\Cache\Exceptions\CacheException

Cache unable to write to /var/www/myproject/writable/cache/

I am on Ubuntu 18.04 using CI4 beta 1.

Entities and pivots

$
0
0
Hi all- this is probably only partially CI related, but since CI4 is introducing me to Entities for the first time I figured it might others as well. I'm wondering what the best practice is for an entity handling its pivot table(s)? Consider this example:

USERS
id, firstname, lastname, email, deleted, created_at, updated_at

WIDGETS
id, name, color, deleted, created_at, updated_at

USERS_WIDGETS
user_id, widget_id, created_at

My simple User model return type is 'App\Entities\User', and my user Entity handles the normal stuff. Now, am iterating through $users->findAll() and want to display each user's widgets. In CodeIgniter 3 I would have a function in my user model $this->User->widgets($user->id) that returned widget_id from users_widgets, and then could use $this->Widget->get($widget_id) if I needed the whole row.
The same could be accomplished in my entity by defining getWidgets() and then I could use $user->widgets - is that how folks typically do it? Or other recommendations / example repos to check out? Do people pass around IDs or entire data rows (e.g. does getWidgets() return an int or an object/array)?
Thanks for the help!

Strange message at the top of my website

$
0
0
I have a website that was built in CodeIgniter 3.x and Bootstrap 3.
Suddenly, on one of my pages, I have a strange message right below the navbar:
Code:
Type=cdir;Modify=20190228205608;Unique=04c800e5ee99c7bc;Perm=cmpdfe;UNIX.mode=0755;UNIX.owner=1998957;UNIX.group=1101; . Type=pdir;Modify=20190228205608;Unique=04c800e5e4dbe742;Perm=cmpdfe;UNIX.mode=0755;UNIX.owner=1998957;UNIX.group=1101; ..
It's nowhere in my own code. Not in my controller and not in my views. Where is this coming from?

Why Routes.php loaded twice?

$
0
0
I know CI loads Routes.php for each module
but
in standard installation, CI loads "Routes.php" twice.

is this a issue or standart?

Should CI-4 require PHP 7.3 ?

$
0
0
I ask because PHP7.2 goes into Security Fixes Only mode on 30 Nov 2019 and reaches the official EOL one year after that. (Chart here) It seems entirely possible that the official CI requirement might be past its prime by the time CI 4 is released.

I'm mostly just being curious It was the encryption poll that got me thinking about this. It seems the "build it in" vote is winning by 2-to-1 so the "'current" PHP version might be highly relevant at release time.

Using PDO connect has error

$
0
0
According to this document [link], following pdo setting will show an error:"Class '\CodeIgniter\Database\pdo\Connection' not found".

But, if i change to the default MySQLi setting that could work normally, i don't know what is wrong?

// use PDO
public $pdotest= [
        'DSN' => 'mysql:dbname=db1;host=localhost',
        'hostname' => 'localhost',
        'username' => 'root',
        'password' => 'xxxx',
        'database' => '',
        'DBDriver' => 'pdo',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug' => (ENVIRONMENT !== 'production'),
        'cacheOn' => false,
        'cacheDir' => '',
        'charset' => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre' => '',
        'encrypt' => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port' => 3306,
    ];

// use default mysql 5.7.24
public $default = [
        'DSN' => '',
        'hostname' => 'localhost',
        'username' => 'root',
        'password' => 'root',
        'database' => 'db1',
        'DBDriver' => 'MySQLi',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug' => (ENVIRONMENT !== 'production'),
        'cacheOn' => false,
        'cacheDir' => '',
        'charset' => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre' => '',
        'encrypt' => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port' => 3306,
    ];

Stuck in fetching specific data

$
0
0
Hello to everyone! I'm creating my own app, where people can share own usernames. I have a problem here. Everthing is fine, but i'm unable to fetch data correctely.

What i want to do is:
  • grub from my database_name where people have a specific platform_name
So basically if people match Telegram, this query will output only those people. 

I'm using this to get usernames but now i need to filter them:

PHP Code:
        public function get_usernames($slug FALSE$limit FALSE$offset FALSE){
            if (
$limit) {
                
$this->db->limit($limit ,$offset);
            }
            if(
$slug === FALSE){
                
$this->db->order_by('usernames.id''DESC');
                
$query $this->db->get('usernames');
                return 
$query->result_array();
            }

            
$query $this->db->get_where('usernames', array('slug' => $slug));
            return 
$query->row_array();
        } 
Viewing all 14343 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>