Creating a Module - Unity3D Integration

Post

Posted
Rating:
Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 (Liked by Chris Graham)
#6740 (In Topic #1552)
Afternoon All

So, restarting my adventures in integrating Unity3D with a Compo.sr based back-end. I'd like to keep my queries together, if that is ok, so if I come up on many different issues, I do apologise.

So today I made a start catching up on things Module related, and was going through the tutorial in the codebook when I ran into 3 problems:

- the get_page_title() function is not recognised by my compo.sr install :(
- what do I need to do to prevent or satisfy this security warning: A POST request was made without a security token; this has been blocked as it represents a security threat.
- my Addons page in the Admin panel gives me a syntax error when my module is present: "Parse error: syntax error, unexpected 'return' (T_RETURN), expecting function (T_FUNCTION) or const (T_CONST) in <snip>/site/sources/zones2.php(794) : eval()'d code on line 37"

Any thoughts out there please?

Kind Regards
Steve
 

Last edit: by Steven Gilson

Post

Posted
Rating:
#6741
Hey Steven :) ,

It turns out the Code Book example is pretty outdated, sorry about that. I'm updating it now. It should go live later today.
(We used to maintain this as a separate document outside the main code repository so it tended to get forgotten)

get_page_title should be get_screen_title.

The form element needs to have {$INSERT_SPAMMER_BLACKHOLE} inside it to add the CSRF token.

The PHP error may be due to code formatting, I'm checking that.

Post

Posted
Rating:
#6742
Hi Chris

Thank You for your response! The Example is now working, just my addon page now :(

Now to dig into the Compo.sr manual……

Steve

Post

Posted
Rating:
#6743
I've updated to live docs.

Also if you want certain formatting errors in modules to not lead to nasty parse errors, this hot-fix will resolve that:
0004609: Don't allow formatting errors in block/module code to cause errors - Composr CMS feature tracker

Post

Posted
Rating:
#6744
OK, cool, thank you. Looking at what you said in your link, I took a look at the galleries.php module to see how you are formatting the code there compared to the tutorial, and copied the info() function exactly, (with my own info for the array) and created empty versions of the uninstall() and install() functions complete with the comments, and my Addon page now works like a charm.

May I suggest a further docs edit to include this learning?

Regards
Steve

Post

Posted
Rating:
#6745
May I suggest a further docs edit to include this learning?

All hot-fixes get rolled into the next patch release, so there's no need to explain it - it just won't give an error in the future.
4 guests and 0 members have recently viewed this.