Welcome Guest, Not a member yet? Register   Sign In
Components for Codeigniter 4
#1

(This post was last modified: 01-06-2025, 11:02 AM by dgvirtual.)

I would like to announce a semi-new Components library for CI4. It allows to encapsulate html and css classes/styles into reusable website building blocks.
See it here: https://packagist.org/packages/dgvirtual...components
It allows to write this in your view:
PHP Code:
<x-green-button onclick="alert('I was clicked!')">
  <?= $clickMeLabel ?>
</x-green-button> 
and after rendering get this sent to your browser:
PHP Code:
<button
    style
="color: white; background-color: green;"
    <?= isset($onclick) ? 'onclick="' $onclick '"' '' ?>
>
    <?= $slot ?>
</button> 
This functionality has been available in Bonfire2 for a while, but I have extracted it and put it into an installable composer package.

Bonfire2 was written mainly by Lonnie Ezell (@kilishan), so most of the credit goes to him.

Hope you will find it as useful as I have.
==

Donatas G.
Reply
#2

@dgvirtual, Thanks this should be helpful.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB