Author Topic: Finding Customization Help for WebsiteBaker Installation  (Read 918 times)

Offline richwingerter

  • Posts: 46
Finding Customization Help for WebsiteBaker Installation
« on: February 18, 2018, 02:48:50 AM »
What is now the best way to get technical help customizing my WebsiteBaker installation (2.8.3+SP7)? I'm looking for help calling an external page that accesses the MySQL database to select records. Which forum would be appropriate?

Basically, I have a dojo xhr() that requests a PHP page lookup data in a custom table in the WB database. I've tried using a regular $database->query($sql), but it doesn't have a connection to the database. I tried creating a WB Code 3.0.0 page with the Administrator and calling it, but then it returns the HTML of the page, instead of executing the PHP and returning the results. I'd like to find someone who has ideas how to solve this.

Thank you for pointing me in the right direction!

Offline jacobi22

  • Posts: 5890
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Finding Customization Help for WebsiteBaker Installation
« Reply #1 on: February 18, 2018, 12:28:20 PM »
2.8.3+SP7??  realy?  Only to say get problems in the future, if your online dealer use a newer PHP- and MySQL-Version

#1 - search in the forum for example's like that or that
or other solutions, specially from User Darkviper
the "secret" is the database-object. ->global $database;

#2 - if you have only a short script - a onepager, that read datas from database and print the results on the same page - use Code²-Module instead of the simple Code-Module
additional Info to the simple Code-Module: if you add your code the first time, you need the open and ending php-tag around this code and in every Code-Section like
Code: [Select]
echo "my Code";
better solution is a own module, specially, if you need module-own tables. it's recommended for addons, where you need own settings or administration for the records etc

Some help:
- Hello World-Module - a example module with a lot of comments
- Developer Guide
- Wiki
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline richwingerter

  • Posts: 46
Re: Finding Customization Help for WebsiteBaker Installation
« Reply #2 on: February 21, 2018, 05:19:09 AM »
Yeah, 2.8.3+SP7. At the time I started this, it was current!

I looked at the examples, and it seems like what I'm doing should work. I tried following DarkViper's suggestion.Remember that this is for an independent PHP page, not one created with the WebsiteBaker Administrator. Could it be that it doesn't get the $database global? Here's the script [check-access-code.php]:

Code: [Select]
global $database;
$sql "SELECT * FROM my_table WHERE person_name='Rich Wingerter'";
if ((
$result $database->query($sql))) {
'Executed SQL';

I'm reaching this through dojo/request/xhr [this is in "list-event.php", which is a webpage within WebsiteBaker]:

Code: [Select]
xhr("check-access-code.php", {
    data: xmldoc,
    method: "POST",
    handleAs: "text"
What I get in the console is:

Code: [Select]
POST https://.../check-access-code.php 500 (Internal Server Error)    dojo.js:8
Error    list-event.php:146
_31e {message: "Unable to load check-access-code.php status: 500", [etc.]

If I comment out the if statement with $database->query() from my script, I don't get any error message and I get the SQL statement printed by echo. Invoking $database->query($sql) makes this error out.

I'll take a look at your Code²-Module suggestion, but I was hoping I wouldn't have to implement a whole module just to get a record out of the database.

Thanks for your help!