Welcome Guest, Not a member yet? Register   Sign In
Anyone using HTMX with CI?
#3

(This post was last modified: 02-22-2023, 03:31 PM by n2fole00.)

(02-22-2023, 11:54 AM)datamweb Wrote: A powerful package for use in Codeigniter has been published by one of the members of Codeigniter.

https://github.com/michalsn/codeigniter-htmx

Cool, I set up a test and tried an example from the docs, but I got this exception when accessing http://localhost/ci4/test/public/ which takes you to Home::index

Code:
"Call to undefined method Michalsn\CodeIgniterHtmx\View\View::fragmentEnd()"

PHP Code:
<h1>Welcome to CodeIgniter <?= CodeIgniter\CodeIgniter::CI_VERSION ?></h1>
            <?php $this->fragment('example'); ?>
            <h2><?= $caption?></h2>
            <?php $this->fragmentEnd(); ?>

PHP Code:
class Home extends BaseController
{
    public function 
index()
    {
        try {
            return 
view('welcome_message', ['caption' => 'Full page returned']);
        } catch (\
Exception $e) {
            exit(
$e->getMessage());
        }
    }

    public function 
pageFragment(): string
    
{
        return 
view_fragment('welcome_message''example', ['caption' => 'Only page fragment returned']);
    } 

Any idea why that is?

Setup was

Code:
composer require michalsn/codeigniter-htmx
Reply


Messages In This Thread
Anyone using HTMX with CI? - by n2fole00 - 02-22-2023, 10:32 AM
RE: Anyone using HTMX with CI? - by datamweb - 02-22-2023, 11:54 AM
RE: Anyone using HTMX with CI? - by n2fole00 - 02-22-2023, 03:29 PM
RE: Anyone using HTMX with CI? - by luckmoshy - 02-22-2023, 11:27 PM
RE: Anyone using HTMX with CI? - by Alesck - 03-15-2023, 06:13 AM
RE: Anyone using HTMX with CI? - by SubrataJ - 03-16-2023, 01:16 AM
RE: Anyone using HTMX with CI? - by JohnSonandrbt - 04-17-2023, 10:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB