MySQL CRUD Custom Component

I am on a roll with using Cursor and now have a basic MySQL CRUD (Create,Read,Update,Delete) working in a Custom Component. I thought this now deserved its own thread. :wink:

Here are some screenshots:

At the moment to get this to work, I am having to do various updates into the Page settings apart from the code in the Custom Component. In the fullness of time, I would like to be able to encapsulated all this into one (or maybe two) Custom Components that are a just configured by the Custom Component properties.

3 Likes

Wow, this is awesome :star_struck: This is exactly what we wanted for custom components. It puts the power in the users hands and you guys can create solutions for yourselves (and others)!!!

Is there anything you need from us to make this work… Do you need to inject things into the head?

Cursor-AI is awesome…good to see others have success with it.

1 Like

Yes, to be able to inject into the Page Setting Areas is what is ideally needed.

For example to be able to configure via a Custom Element’s property items such as a MySQL database name, user id and password. and for the associated PHP code, updated with the property values to be able to be injected into the Page Settings. In this Custom Component, I am injecting into the Page Start, Body Start and Body End. I ideally wanted to add a class to the tag - not sure if that is possible - so I topped and tailed a DIV in the Body Start / Body End to include the class.

A mechanism to show them in the Page Settings, but make these injections non-modifiable (except by the Custom Component) would be a bonus.

Finally to be able to package these to share the Custom Components as opposed to projects with them included would be good, I guess this will happend in due course?

There might be other things to add to this list, once I get a bit futher down the line. :slight_smile:

1 Like

I don’t think you want to inject them into the Page Settings area, how about you just do it directly :wink:

I think we have a large part of what you need covered with the next beta (v13). Take a look at the new portal feature and see if that would work for you!

Yes, this is 100% planned, and if you guys keep producing all these custom components, we’re going to need to do it sooner rather than later!

Perfect, keep us posted!

2 Likes

Hi @dan ,

Ohhhh… some api to look at - good stuff. Ok so if multiple components are injecting php into the head (or anywhere else for that matter), will it keep the code blocks separate?, ie. not try to fit one piece of code inside of existing php tags - I’ve seen code mutation problems before and I don’t want to fight this anymore :wink:

Another thought - probably for css that’s unique to a component (not sure if would need for js yet), can we tell the api that all those code blocks from my components plus any other components should be combined into a single minimized css call in head?

Also, need a portal for putting php above the doctype - thanks.

Hi @dan, that look’s like a good way forward. :+1:

As @Bill notes, the most essential addition (to support PHP code via the Portal) is to have:

@portal(pageStart)
//Code here will be transported to the top of the page.
@endportal

This is because we need to have the capability to have PHP code run before the first line of HTML code i.e. the DOCTYPE statement.

With this addition, it will be very useful. :slight_smile: