PHP Integration

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SF123

I have a chat app I’m building that has a MySQLi + PHP backend, using Godot for the frontend and I need to list all the users and make them clickable, which will open your chat with them. I can use an ItemList node but is there any way to make the items bigger on that?

By the way, I send a request to my server and it sends me back an array of the users, so I can use a for user in users type of thing for that part, I just need to know how I can either have larger items on an ItemList node, or if there’s another way to do this.

Thanks in advance

:bust_in_silhouette: Reply From: SF123

I found the answer, I simply needed to do something like this:

for CHAT in CHATS:
    var BUTTON = Button.new()
    BUTTON.text = "Full Name - (Username)"
    
    CHATS_CONTAINER.add_child(BUTTON)

Here’s the code I ended up using:

func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
	var RESULT = body.get_string_from_utf8() #Data returned by backend
	
	var USERS = parse_json(RESULT) #parse from json
	
	for USER in USERS:
		var CHAT = Button.new() #Create a new button
		CHAT.text = USER[1] + " - (" + USER[0] + ")" #set the chat label text
		CHAT.connect("pressed", self, "_chat_pressed", [CHAT, USER[0], USER]) #connect the pressed to a function
		CHAT.rect_min_size.x = 250
		CHAT.rect_min_size.y = 35
		CHATS.add_child(CHAT) #add the button to the VBox Container