Welcome Guest, Not a member yet? Register   Sign In
View Render Controlled Cells + spark make:cell bug
#1

(This post was last modified: 04-18-2023, 09:35 AM by Corsari.)

Hello + (possible spark make:cell bug found , see at bottom)

I'm following the guide

here

https://codeigniter.com/user_guide/outgo...olled-cell

the paragraph title is "Creating a Controlled Cell"

but right after I'd expect a "Viewing/Rendering a Controlled Cell" :-((



I have used the provided spark command

PHP Code:
php spark make:cell MyTestCell 


it has created the cell controller and the view both in the expected /app/cells path



the controller doesn't have any method: should I create one? Or is there any default method provided by the

PHP Code:
class MyTestCell extends Cell 


thank you for clarifying , also I gently suggest to add that "Viewing a Controlled Cell" in the guide

or allow the

PHP Code:
php spark make:cell MyTestCell 



to create a controller with a default method

Ok solved
analyzing the extended Cell class I find the ::render method

could it be that I have found a spark make:cell bug? I have created a second cell with

> php spark make:cell AdmSideMenu

the make:cell command has created these two files
/app/Cells/AdmSideMenu.php
/app/Cells/adm_side_menu_cell.php

then I've tried this
<?= view_cell('AdmSideMenu::render'); ?>

and I get this error
include(/var/www/ticket/app/Cells/adm_side_menu.php): Failed to open stream: No such file or directory

as you can see it does expect adm_side_menu.php while the spark command created a adm_side_menu_cell.php file
Reply
#2

It is a bug, and it is already fixed in develop:
https://github.com/codeigniter4/CodeIgniter4/pull/7392
Reply
#3

(04-18-2023, 09:09 PM)kenjis Wrote: It is a bug, and it is already fixed in develop:
https://github.com/codeigniter4/CodeIgniter4/pull/7392

Ok

Hopefully you may consider to add what suggested above to the guide

Still about cells
It is a reasonable practice to use them inside the main view of a layout?

Or is it a no sense?

Are there pro/cons or is it a "neutral" choice?
Thank you for indications about this topic
Reply




Theme © iAndrew 2016 - Forum software by © MyBB